Run benchmarks with stdlib native modules#6792
Conversation
📝 WalkthroughWalkthroughAdds Changes
Sequence Diagram(s)sequenceDiagram
participant Bench as Bench Harness
participant Init as Interpreter::with_init
participant VM as VM (pre-enter block)
participant Stdlib as rustpython_stdlib
Bench->>Init: construct Interpreter::with_init(...)
Init->>VM: enter pre-init closure
VM->>Stdlib: rustpython_stdlib::get_module_inits()
VM->>Stdlib: vm.add_native_modules(module_inits)
VM-->>Bench: VM ready with native stdlib modules
Bench->>VM: run benchmark code (imports/use stdlib)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
|
Code has been automatically formatted The code in this PR has been formatted using:
git pull origin benchmark-with-stdlib |
4550ea9 to
e0c812d
Compare
Change benchmark interpreter from without_stdlib to with_init to load Rust-optimized native modules like _json, ensuring benchmarks measure actual optimized performance rather than pure Python fallbacks. Co-Authored-By: Claude Opus 4.5 <[email protected]>
e0c812d to
c3180e3
Compare
youknowone
left a comment
There was a problem hiding this comment.
Probably that was written for vm performance at the first time.
Personally, I was checking https://rustpython.github.io/benchmarks to see if benchmarks improved after the
json.loadsenhancement, but there was actually no performance improvement. Upon reviewing this again, I suspect it was running with a Pure Python implementation using an interpreter without stdlib. So if there are no particular issues, how about running the benchmark with a version that includes stdlib?I'm not very familiar with whether the presence of a standard library has a significant impact on performance benchmarks, so I would be really happy if you could share your opinion!
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.