MCPcopy Index your code
hub / github.com/RustPython/RustPython / benchmark_pystone

Function benchmark_pystone

benches/execution.rs:71–85  ·  view source on GitHub ↗
(group: &mut BenchmarkGroup<WallTime>, contents: String)

Source from the content-addressed store, hash-verified

69}
70
71pub fn benchmark_pystone(group: &mut BenchmarkGroup<WallTime>, contents: String) {
72 // Default is 50_000. This takes a while, so reduce it to 30k.
73 for idx in (10_000..=30_000).step_by(10_000) {
74 let code_with_loops = format!("LOOPS = {idx}\n{contents}");
75 let code_str = code_with_loops.as_str();
76
77 group.throughput(Throughput::Elements(idx as u64));
78 group.bench_function(BenchmarkId::new("cpython", idx), |b| {
79 bench_cpython_code(b, code_str)
80 });
81 group.bench_function(BenchmarkId::new("rustpython", idx), |b| {
82 bench_rustpython_code(b, "pystone", code_str)
83 });
84 }
85}
86
87pub fn criterion_benchmark(c: &mut Criterion) {
88 let benchmark_dir = Path::new("./benches/benchmarks/");

Callers 1

criterion_benchmarkFunction · 0.85

Calls 4

newFunction · 0.85
bench_cpython_codeFunction · 0.70
bench_rustpython_codeFunction · 0.70
as_strMethod · 0.45

Tested by

no test coverage detected