Re:Benchmarking Rust with Project Euler Solutions
by teoryn on Saturday August 30, 2014 @01:17PM
(#8246958)
What's the reason for 'asm("");' in 002.c (and other c codes)? All I can see that doing is intentionally breaking the compiler's ability to optimize over loop iterations, which puts rust a huge advantage over c.
[ Parent
| on HN ]
Re:Benchmarking Rust with Project Euler Solutions
by jasondavies on Saturday August 30, 2014 @04:59PM
(#8247587)
It's probably to avoid dead-code elimination, which would defeat the purpose of the benchmark. The rust benchmarks use test::black_box [0], which does the same thing, so there's no unfair advantage there.
Re:Benchmarking Rust with Project Euler Solutions
by bilalhusain on Saturday August 30, 2014 @05:57PM
(#8247704)
But it appears that the Rust code is avoiding optimization over f() whereas for C code `asm("");` is inside iteration loop.