Closed
Description
I have a strange performance difference on the standard rust heapsort implementation and a trivial modification.
The only difference is in line 15 where the right index is calculated from the left index. I thought this is a trivial optimization for a compiler.
running 2 tests
test bench_heapsort_new ... bench: 6,950,925 ns/iter (+/- 283,342)
test bench_heapsort_old ... bench: 7,799,111 ns/iter (+/- 181,397)
rustc 1.18.0-nightly (ddc5d7bd4 2017-04-20)
rustc --test -O slice.rs