MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / bench_push_fast

Function bench_push_fast

src/fast.rs:526–538  ·  view source on GitHub ↗
(b: &mut Bencher)

Source from the content-addressed store, hash-verified

524
525 #[bench]
526 fn bench_push_fast(b: &mut Bencher) {
527 let mut buffer = VecT::with_capacity(N);
528 b.iter(|| {
529 buffer.clear();
530 let mut vec = black_box(FastVec::from(std::mem::take(&mut buffer)));
531 for _ in 0..black_box(N) {
532 let v = black_box(&mut vec);
533 v.reserve(1);
534 unsafe { v.push_unchecked(black_box(0)) };
535 }
536 buffer = vec.into();
537 });
538 }
539
540 #[bench]
541 fn bench_push_unchecked(b: &mut Bencher) {

Callers

nothing calls this directly

Calls 3

clearMethod · 0.80
push_uncheckedMethod · 0.80
reserveMethod · 0.45

Tested by

no test coverage detected