Skip to content

Instantly share code, notes, and snippets.

@oyvindln oyvindln/vec.cpp
Last active Aug 11, 2017

Embed
What would you like to do?
rust vs cpp diff
// clang++ -S -std=c++11 -emit-llvm -vec.cpp -o vec_cpp.ll
// lines: 891
// ( wc -l vec_cpp.ll )
// with stripped blank lines and comments:
// ( sed '/^\s*;/d;/^\s*$/d' vec_cpp.ll | wc -l )
// 698
#include <cinttypes>
#include <vector>
int main(int, char* []) {
auto v = std::vector<int32_t>(0, 100);
for (auto n : v) {
}
}
// rustc +nightly --emit llvm-ir vec.rs -o vec_rust.ll
// lines: 4634
// ( wc -l vec_rust.ll )
// with stripped blank lines and comments:
// ( sed '/^\s*;/d;/^\s*$/d' vec_rust.ll | wc -l )
// 3523
fn main() {
let v = vec![0i32;100];
for n in v {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.