Skip to content

Run benchmark workloads with consistent script namespaces - #9027

Merged
youknowone merged 1 commit into
RustPython:mainfrom
1ndahous3:benchmark_script_entrypoints
Oct 10, 2026
Merged

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

Conversation

@1ndahous3

@1ndahous3 1ndahous3 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Run execution benchmarks in fresh __main__ namespaces in both interpreters. This enables the previously skipped pystone and fannkuch workloads and prevents CPython from retaining module globals between iterations.
  • Use the same namespace for CPython microbenchmark setup and execution, including global lookups from functions defined during setup.
  • Give local microbenchmark sizes distinct IDs to prevent Criterion's duplicate-ID panic, while preserving existing CodSpeed names.

Previous pystone and fannkuch results need a new baseline because they did not execute the main workloads.

AI assistance

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

Summary by CodeRabbit

  • Chores
    • Benchmark runs now use explicit iteration counts, with local runs covering five sizes from 100 to 900 iterations.
    • Execution benchmarks now include compilation and run in a fresh script-like context for each iteration.
    • Benchmark setup and measured code now share a consistent execution context.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 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-09T16:10:55.722115Z ec6b9d5 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 9, 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: e414712e-a531-4f25-8c15-c419d9e3df88

📥 Commits

Reviewing files that changed from the base of the PR and between f5b6526 and ec6b9d5.


📒 Files selected for processing (3)
  • benches/README.md
  • benches/execution.rs
  • benches/microbenchmarks.rs

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



📝 Walkthrough

Walkthrough

The benchmark code now uses consistent main-style namespaces for script execution and CPython microbenchmark setup. Benchmark IDs include iteration counts for local runs, while CodSpeed uses its configured naming behavior. The README describes the updated iteration settings.

Changes

Benchmark execution and iteration

Layer / File(s) Summary
Script execution namespaces
benches/execution.rs, benches/README.md
CPython compiles scripts and runs them with __name__ set to "__main__". RustPython sets the same global before execution. The README documents this script execution behavior.
Microbenchmark setup and naming
benches/microbenchmarks.rs, benches/README.md
CPython setup and benchmark code use one globals dictionary. Local benchmark IDs include iteration counts. RustPython iteration names use the benchmark name under CodSpeed and append [idx] otherwise. The README lists the local iteration sizes and CodSpeed setting.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: moreal


Merge Risk: ⚪ Minimal · up to ec6b9

The benchmark naming change does not affect CodSpeed’s existing names. No merge-blocking issue was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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 4 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 describes the main change: running benchmark workloads with consistent script namespaces.
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.

Full details: Docstring Coverage

Explanation

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 4 functions across 2 files. (1 skipped: 1 unsupported.)



  • 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 3af5f8a into RustPython:main Oct 10, 2026
21 checks passed
@1ndahous3
1ndahous3 deleted the benchmark_script_entrypoints branch October 13, 2026 08:23
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