2021-05-26 06:25:00 +00:00
|
|
|
use criterion::{criterion_group, criterion_main, Bencher, Criterion};
|
2020-04-07 19:37:02 +00:00
|
|
|
|
|
|
|
use pyo3::prelude::*;
|
|
|
|
|
|
|
|
fn drop_many_objects(b: &mut Bencher) {
|
|
|
|
let gil = Python::acquire_gil();
|
|
|
|
let py = gil.python();
|
|
|
|
b.iter(|| {
|
|
|
|
for _ in 0..1000 {
|
|
|
|
std::mem::drop(py.None());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-05-26 06:25:00 +00:00
|
|
|
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
|
|
c.bench_function("drop_many_objects", drop_many_objects);
|
|
|
|
}
|
|
|
|
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
|
|
criterion_main!(benches);
|