rust/library/alloc
bors a090c8659c Auto merge of #91527 - the8472:retain-opt, r=dtolnay
Optimize `vec::retain` performance

This simply moves the loops into the inner function which leads to better results.

```
old:

test vec::bench_retain_100000                            ... bench:     203,828 ns/iter (+/- 2,101)
test vec::bench_retain_iter_100000                       ... bench:      63,324 ns/iter (+/- 12,305)
test vec::bench_retain_whole_100000                      ... bench:      42,989 ns/iter (+/- 291)

new:

test vec::bench_retain_100000                            ... bench:      42,180 ns/iter (+/- 451)
test vec::bench_retain_iter_100000                       ... bench:      65,167 ns/iter (+/- 11,971)
test vec::bench_retain_whole_100000                      ... bench:      33,736 ns/iter (+/- 12,404)
```

Measured on x86_64-unknown-linux-gnu, Zen2

Fixes #91497
2021-12-16 07:58:36 +00:00
..
benches update vec::retain benchmarks 2021-12-04 16:20:35 +01:00
src Auto merge of #91527 - the8472:retain-opt, r=dtolnay 2021-12-16 07:58:36 +00:00
tests Rollup merge of #91916 - steffahn:fix-typos, r=dtolnay 2021-12-15 10:57:02 +01:00
Cargo.toml