From bacf259d401226b85ce48d20b86ddf685a528e4b Mon Sep 17 00:00:00 2001 From: CodSpeed Bot Date: Wed, 14 Oct 2026 18:01:34 +0000 Subject: [PATCH] Pin the hash seed in the microbenchmark harness Settings::default() leaves hash_seed = None, so every benchmark process draws a random str hash secret. That changes globals-dict probe lengths between runs and makes dict/loop/string microbenchmarks swing by 10-17% with no code change. Use a fixed seed so results only move when the code does. --- benches/microbenchmarks.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/benches/microbenchmarks.rs b/benches/microbenchmarks.rs index 1c3bfea55a3..7909c8e445e 100644 --- a/benches/microbenchmarks.rs +++ b/benches/microbenchmarks.rs @@ -107,6 +107,9 @@ fn bench_rustpython_code(group: &mut BenchmarkGroup<'_, WallTime>, bench: &Micro settings.path_list.push("Lib/".to_string()); settings.write_bytecode = false; settings.user_site_directory = false; + // Pin the str/bytes hash secret so dict/set probe sequences (and thus + // timings) are reproducible across benchmark runs. + settings.hash_seed = Some(0); let builder = Interpreter::builder(settings); let defs = rustpython_stdlib::stdlib_module_defs(&builder.ctx);