1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#![feature(test)] extern crate test; use pyo3::prelude::*; use test::Bencher; #[bench] 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()); } }); }