(b: &mut Bencher, source: &str)
| 7 | use std::{collections::HashMap, hint::black_box, path::Path}; |
| 8 | |
| 9 | fn bench_cpython_code(b: &mut Bencher, source: &str) { |
| 10 | let c_str_source_head = std::ffi::CString::new(source).unwrap(); |
| 11 | let c_str_source = c_str_source_head.as_c_str(); |
| 12 | pyo3::Python::attach(|py| { |
| 13 | b.iter(|| { |
| 14 | let module = pyo3::types::PyModule::from_code(py, c_str_source, c"", c"") |
| 15 | .expect("Error running source"); |
| 16 | black_box(module); |
| 17 | }) |
| 18 | }) |
| 19 | } |
| 20 | |
| 21 | fn bench_rustpython_code(b: &mut Bencher, name: &str, source: &str) { |
| 22 | // NOTE: Take long time. |
no test coverage detected