Repository navigation
perf: reuse validated JSON values for version operations - #114
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
📦 napi-rs Build Size Comparison
Total: 949.96 KB → 953.96 KB (+4.00 KB, +.42%) Compared using x86_64-unknown-linux-gnu target |
|
@codex review |
⚡ Benchmark ResultsClick to expand benchmark outputBenchmark ran on x86_64-unknown-linux-gnu target |
Merging this PR will improve performance by 21.85%
|
Version lookups and comparisons scan and validate the same
versionsobject multiple times. The implementation now reuses validatedsonic-rsvalues to avoid these repeated scans. It preserves input validation and byte positions for JSON edits.Add benchmarks for version lookup, comparison, and mutation to CodSpeed. Make the metadata benchmarks compare the same fields, and remove the fixed speedup claim for
getMetaInfo().The table shows median latency in milliseconds from the second paired comparison. Both sides used the same fixtures and
tinybench@5.1.0. Both native binaries used release mode. The machine used an Apple M4 Max, macOSarm64, and Node.jsv24.22.0.Each
Packageoperation includes construction. Each mutation creates a newJSONBuilder. Speedup equals the previous latency divided by the new latency.getLatestVersion()diff()JSONBuilder.setIn()JSONBuilder.deleteIn()getMetaInfo()Across both paired comparisons, version lookup and comparison improve by 2.35–2.48× on these large fixtures, including construction. The gain depends on the operation;
getMetaInfo()remains approximately unchanged.Summary by CodeRabbit