about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-04-10 07:54:18 +0000
committerbors <bors@rust-lang.org>2015-04-10 07:54:18 +0000
commite4f9ddb878992a9a4edd2667423c29b129ce4301 (patch)
treec95263ad9c6feb991f36107f84a4b7a402d36e08 /src/libstd/sys/unix/stack_overflow.rs
parent6b95d8bed8afff7262ec5623677e320bf63d2230 (diff)
parentc2258d6d042353bfa6daad6008bcd3c0af3f13de (diff)
downloadrust-e4f9ddb878992a9a4edd2667423c29b129ce4301.tar.gz
rust-e4f9ddb878992a9a4edd2667423c29b129ce4301.zip
Auto merge of #24180 - huonw:optimise-max-etc, r=alexcrichton
The main change in this patch is removing the use of `Option` inside the
inner loops of those functions to avoid comparisons where one branch
will only trigger on the first pass through the loop.

The included benchmarks go from:

    test bench_max    ... bench:       372 ns/iter (+/- 118)
    test bench_max_by ... bench:       428 ns/iter (+/- 33)
    test bench_max_by2 ... bench:      7128 ns/iter (+/- 326)

to:

    test bench_max    ... bench:       317 ns/iter (+/- 64)
    test bench_max_by ... bench:       356 ns/iter (+/- 270)
    test bench_max_by2 ... bench:      1387 ns/iter (+/- 183)

Problem noticed in http://www.reddit.com/r/rust/comments/31syce/using_iterators_to_find_the_index_of_the_min_or/
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions