Skip to content

Instantly share code, notes, and snippets.

@marijnh
Created March 9, 2012 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marijnh/2008845 to your computer and use it in GitHub Desktop.
Save marijnh/2008845 to your computer and use it in GitHub Desktop.
fn main() {
let x = vec::init_elt(5000u, 20), y = 0;
int::range(0, 10000, {|_i|
y += vec::foldl(1, x, {|a, b| a + b});
vec::iteri(x, {|i, e| y += i as int + e;});
y += vec::map(x, {|x| x + 2}).len() as int;
});
log(error, y);
}
~/src/rust > x86_64-unknown-linux-gnu/stage2/bin/rustc -O foo.rs
~/src/rust > time ./foo
rust: 127025010000
real 0m1.141s
user 0m1.120s
sys 0m0.010s
~/src/rust > x86_64-unknown-linux-gnu/stage0/bin/rustc -O foo.rs
~/src/rust > time ./foo
rust: 127025010000
real 0m6.604s
user 0m6.580s
sys 0m0.010s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment