Skip to content

Exclude setup cleanup from microbenchmark measurements - #9244

Merged
youknowone merged 1 commit into
RustPython:mainfrom
1ndahous3:frozenset_benchmark
Oct 20, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
1ndahous3:frozenset_benchmark

Conversation

@1ndahous3

@1ndahous3 1ndahous3 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Found while investigating recurring frozenset benchmark regressions.

Summary

  • Keep RustPython's setup scope alive until timing ends, matching the CPython harness.
  • Exclude setup-object destruction from microbenchmark timings while preserving a fresh, uncached frozenset hash in each iteration.

Performance

Local release wall-time for a 1,000-element frozenset, in µs. This changes the measurement boundary; interpreter code is unchanged.

Windows 11 x64

Before: hash + scope cleanup After: hash
18.59 2.22

Debian 13 amd64

Before: hash + scope cleanup After: hash
13.63 1.81

AI assistance

Written with Codex (GPT-6), reviewed by a human before submission.

Summary by CodeRabbit

  • Refactor
    • Updated internal microbenchmark execution to preserve setup state during timing.
    • Standardized benchmark runs to use reference-based batching for iterative and non-iterative cases.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T08:11:21.821083Z 800119d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4aa5ba0a-ae64-40aa-be50-420c79b7d214
📥 Commits

Reviewing files that changed from the base of the PR and between 398dd70 and 800119d.

📒 Files selected for processing: 1
  • benches/microbenchmarks.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

RustPython microbenchmarks now pass a cloned scope to code execution and use Criterion’s iter_batched_ref for iterative and non-iterative benchmarks.

Changes: RustPython microbenchmarks

Layer / File(s) Summary
Scope handling and benchmark batching
benches/microbenchmarks.rs
The benchmark closure accepts an explicit mutable Scope and passes a clone to code execution. Both benchmark paths use iter_batched_ref.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: youknowone

Merge Risk: ⚪ Minimal · up to 80011

The benchmark timing change is mergeable with no actionable current-head risk established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: excluding setup cleanup from microbenchmark measurements.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@youknowone
youknowone merged commit 89bc9d9 into RustPython:main Oct 20, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants