-
-
Notifications
You must be signed in to change notification settings - Fork 32
feat: add benchmark for package.json deserialization #698
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
- Made PackageJson::parse() public to enable benchmarking - Added comprehensive benchmarks testing various package.json sizes: - Small (323ns): Basic name/version fields - Medium (1.4µs): Includes exports, imports, browser fields - Large (3.5µs): Complex nested structure with dependencies - Real file (2.3µs): Actual package.json from fixtures - Batch parsing (7.7µs): Sequential parsing of 4 files - Parallel batch (27.5µs): Parallel parsing using rayon This helps measure and track the performance of package.json parsing, which is a critical operation in the resolver. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
How to use the Graphite Merge QueueAdd the label merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #698 +/- ##
==========================================
- Coverage 94.90% 94.89% -0.01%
==========================================
Files 12 12
Lines 2886 2882 -4
==========================================
- Hits 2739 2735 -4
Misses 147 147 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CodSpeed Performance ReportMerging #698 will not alter performanceComparing Summary
Benchmarks breakdown
|
## Summary - Added comprehensive benchmark suite for `PackageJson::parse()` to measure deserialization performance - Made `PackageJson::parse()` public API to enable benchmarking from outside the crate - Benchmarks cover various package.json complexity levels from simple to complex real-world files ## Benchmark Results The new benchmarks test different package.json sizes and parsing scenarios: | Benchmark | Time | Description | |-----------|------|-------------| | Small | ~323ns | Basic name/version fields only | | Medium | ~1.4µs | Includes main, exports, imports, browser fields | | Large | ~3.5µs | Complex nested exports/imports with dependencies | | Real Complex | ~2.3µs | Actual package.json from fixtures | | Batch (4 files) | ~7.7µs | Sequential parsing of 4 different files | | Parallel Batch | ~27.5µs | Parallel parsing using rayon | ## Motivation Package.json parsing is a critical operation in the resolver that happens frequently. Having benchmarks helps: - Track performance regressions - Optimize the parsing logic - Understand the performance characteristics of different package.json structures ## Test Plan - [x] Benchmarks compile and run successfully - [x] `cargo bench package_json_deserialization` produces consistent results - [x] No breaking changes to existing code (only made one internal function public) 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Summary
PackageJson::parse()
to measure deserialization performancePackageJson::parse()
public API to enable benchmarking from outside the crateBenchmark Results
The new benchmarks test different package.json sizes and parsing scenarios:
Motivation
Package.json parsing is a critical operation in the resolver that happens frequently. Having benchmarks helps:
Test Plan
cargo bench package_json_deserialization
produces consistent results🤖 Generated with Claude Code