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

Function bench_pack_ints

src/pack_ints.rs:626–636  ·  view source on GitHub ↗
(b: &mut Bencher, src: &[T])

Source from the content-addressed store, hash-verified

624 test!(test_isize, isize);
625
626 fn bench_pack_ints<T: Int>(b: &mut Bencher, src: &[T]) {
627 let mut ints = src.to_vec();
628 let mut out = Vec::with_capacity(std::mem::size_of_val(src) + 10);
629 let starting_cap = out.capacity();
630 b.iter(|| {
631 ints.copy_from_slice(&src);
632 out.clear();
633 super::pack_ints(black_box(&mut ints), black_box(&mut out));
634 });
635 assert_eq!(out.capacity(), starting_cap);
636 }
637
638 fn bench_unpack_ints<T: Int>(b: &mut Bencher, src: &[T]) {
639 let packed = pack_ints(&mut src.to_vec());

Callers

nothing calls this directly

Calls 2

pack_intsFunction · 0.85
clearMethod · 0.80

Tested by

no test coverage detected