Open
Description
With the following rust code:
pub fn main() {
print_triples();
println!("hello");
}
fn print_triples() {
let mut i = 0 as i32;
for z in 1.. {
for x in 1..=z {
for y in x..=z {
if x*x + y*y == z*z {
i = i + 1;
if i == 1000 {
return;
}
}
}
}
}
}
I get:
/tmp/pythagoras$ rustc --emit=link -O simple.rs
/tmp/pythagoras$ time ./simple
hello
real 0m0.290s
user 0m0.287s
sys 0m0.002s
/tmp/pythagoras$ rustc --emit=asm,link -O simple.rs
/tmp/pythagoras$ time ./simple
hello
real 0m0.005s
user 0m0.002s
sys 0m0.002s
/tmp/pythagoras$ rustc --version
rustc 1.32.0-nightly (400c2bc5e 2018-11-27)
/tmp/pythagoras$