diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-02-22 14:57:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-22 14:57:58 +0100 |
| commit | 70cc6c980cb4540d05a628f492d365ae422fa22f (patch) | |
| tree | 4156d0969c9f943778c91bca6930356fec70bc72 /src/liballoc/benches | |
| parent | ec8ef1836af5dbc8df91989de4ae6a9bd6664178 (diff) | |
| parent | 64c915e3ade66d3335c445eed89509dc41502c13 (diff) | |
Rollup merge of #58064 - llogiq:vec-deque-try-rfold, r=scottmcm
override `VecDeque::try_rfold`, also update iterator This keeps the slice based iteration and updates the iterator state after each slice. It also uses a loop to reduce the amount of code. This uses unsafe code, so some thorough review would be appreciated. Cc @RalfJung
Diffstat (limited to 'src/liballoc/benches')
| -rw-r--r-- | src/liballoc/benches/vec_deque.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/liballoc/benches/vec_deque.rs b/src/liballoc/benches/vec_deque.rs index f7aadbdbd82..7d2d3cfa612 100644 --- a/src/liballoc/benches/vec_deque.rs +++ b/src/liballoc/benches/vec_deque.rs @@ -45,3 +45,10 @@ fn bench_mut_iter_1000(b: &mut Bencher) { black_box(sum); }) } + +#[bench] +fn bench_try_fold(b: &mut Bencher) { + let ring: VecDeque<_> = (0..1000).collect(); + + b.iter(|| black_box(ring.iter().try_fold(0, |a, b| Some(a + b)))) +} |
