-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Introduce json_loads executions benchmark
#6723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughA new JSON loading benchmark script is added that reads and parses a JSON file from the data directory using the standard library's json module to measure JSON deserialization performance. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
benches/benchmarks/json_loads.py (2)
3-4: Consider specifying explicit UTF-8 encoding.JSON files are UTF-8 by specification. Without an explicit
encodingparameter, Python uses the system's default encoding, which may differ on some platforms.Suggested improvement
-with open('benches/_data/pypi_org__simple__psutil.json') as f: +with open('benches/_data/pypi_org__simple__psutil.json', encoding='utf-8') as f: data = f.read()
5-7: Remove extra blank line.PEP 8 recommends a single blank line between logical sections within a module. There are two consecutive blank lines here.
Suggested fix
with open('benches/_data/pypi_org__simple__psutil.json') as f: data = f.read() - loaded = json.loads(data)
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
benches/_data/pypi_org__simple__psutil.jsonbenches/benchmarks/json_loads.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.py: In most cases, Python code should not be edited; bug fixes should be made through Rust code modifications only
Follow PEP 8 style for custom Python code
Use ruff for linting Python code
Files:
benches/benchmarks/json_loads.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Run rust tests (windows-2025)
- GitHub Check: Run rust tests (ubuntu-latest)
- GitHub Check: Run snippets and cpython tests (windows-2025)
- GitHub Check: Run snippets and cpython tests (ubuntu-latest)
- GitHub Check: Ensure compilation on various targets
- GitHub Check: Check the WASM package and demo
- GitHub Check: Check Rust code with clippy
- GitHub Check: Run snippets and cpython tests on wasm-wasi
Unfortunately the |
I'm fixing the benchmark job in cron-ci workflow in #6724 (Although you've already seen the PR and added revisions, I'm leaving a comment on this PR to preserve context. 😅) |
This pull request adds a benchmark for the
json_loadsfunction under the executions category. The dummy data is the metadata of the psutil package, which is decoded during thepip install pyperfprocess. I hope it becomes trackable at https://rustpython.github.io/benchmarks.If there are any changes needed for the benchmark category or the benchmark dummy data, please let me know.
NOTE: This pull request was extracted from PR #6704.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.