4 ms·
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
by jasondavies 12y ago
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.
[0]: http://doc.rust-lang.org/test/fn.black_box.html http://doc.rust-lang.org/test/fn.black_box.html
- bilalhusain 12y agoBut it appears that the Rust code is avoiding optimization over f() whereas for C code `asm("");` is inside iteration loop.