2021-02-24 00:15:58 -08:00
|
|
|
#![feature(test)]
|
|
|
|
|
|
|
|
extern crate test;
|
|
|
|
|
2021-12-03 09:00:31 -08:00
|
|
|
use {
|
2021-12-11 06:44:15 -08:00
|
|
|
solana_perf::{packet::PacketBatchRecycler, recycler::Recycler},
|
2021-12-03 09:00:31 -08:00
|
|
|
test::Bencher,
|
|
|
|
};
|
2021-02-24 00:15:58 -08:00
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn bench_recycler(bencher: &mut Bencher) {
|
|
|
|
solana_logger::setup();
|
|
|
|
|
2021-12-11 06:44:15 -08:00
|
|
|
let recycler: PacketBatchRecycler = Recycler::default();
|
2021-02-24 00:15:58 -08:00
|
|
|
|
|
|
|
for _ in 0..1000 {
|
2021-04-07 08:15:38 -07:00
|
|
|
let _packet = recycler.allocate("");
|
2021-02-24 00:15:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
bencher.iter(move || {
|
2021-04-07 08:15:38 -07:00
|
|
|
let _packet = recycler.allocate("");
|
2021-02-24 00:15:58 -08:00
|
|
|
});
|
|
|
|
}
|