Skip to content

fix(package_json): stop stripping raw_json fields (keep all)#268

Draft
stormslowly wants to merge 1 commit into
bench/raw-json-feature-on-baselinefrom
fix/package-json-raw-keep-fields
Draft

fix(package_json): stop stripping raw_json fields (keep all)#268
stormslowly wants to merge 1 commit into
bench/raw-json-feature-on-baselinefrom
fix/package-json-raw-keep-fields

Conversation

@stormslowly
Copy link
Copy Markdown
Collaborator

@stormslowly stormslowly commented Jun 4, 2026

Why

PackageJson::raw_json() exposes the parsed package.json to consumers, but JSONCell::try_new stripped description/keywords/scripts/dependencies/devDependencies/peerDependencies/optionalDependencies before storing it — so the "raw" API was not actually raw. This PR stops stripping; the full document is retained.

What

This PR is stacked on #269 (the feature-on baseline that keeps stripping). The only diff against #269 is removing the json_object.remove(...) calls, so the CodSpeed report on this PR compares keep vs strip directly — one table, same lineage, same runner (no environment warning).

Strip vs keep (feature on, same environment)

Both built with package_json_raw_json_api; the only difference is whether fields are stripped:

Mode Benchmark strip (#269) keep (this PR) Δ
Memory single-thread 12.8 MB 19.4 MB +6.6 MB (+52%)
Memory resolve with many extensions 17.9 MB 24.4 MB +6.5 MB (+36%)
CPU single-thread 62.0 ms 72.1 ms +16%
CPU multi-threaded resolve 71.3 ms 82.9 ms +16%
CPU resolve with many extensions 137.6 ms 148.8 ms +8%

7 of 12 benchmarks unchanged (tsconfig, pnp, …). Memory is deterministic heap bytes and reproduced byte-for-byte across runs. Keeping the fields costs ~6.6 MB / ~16% on parse-heavy paths — the price of materializing dependencies/scripts/… into serde_json::Value for every package.json.

Measurement/review pair with #269 — not intended to merge as-is.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jun 4, 2026

Merging this PR will degrade performance by 19.76%

❌ 5 regressed benchmarks
✅ 7 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory resolver[single-thread] 12.8 MB 19.4 MB -33.82%
Memory resolver[[single-threaded]resolve with many extensions] 17.9 MB 24.4 MB -26.66%
Simulation resolver[[multi-threaded]resolve] 71.3 ms 82.9 ms -13.92%
Simulation resolver[single-thread] 62 ms 72.1 ms -13.91%
Simulation resolver[[single-threaded]resolve with many extensions] 137.6 ms 148.8 ms -7.55%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix/package-json-raw-keep-fields (4e3bc52) with bench/raw-json-feature-on-baseline (b9e212a)

Open in CodSpeed

The package_json_raw_json_api feature exposes the parsed package.json to
consumers, but try_new stripped description, keywords, scripts and the
dependency maps before storing them. Stop removing those fields so the
raw JSON API returns the complete document.
@stormslowly stormslowly force-pushed the fix/package-json-raw-keep-fields branch from 1a6456d to 4e3bc52 Compare June 4, 2026 08:19
@stormslowly stormslowly changed the base branch from main to bench/raw-json-feature-on-baseline June 4, 2026 08:20
@stormslowly stormslowly changed the title fix(package_json): keep all fields in raw json api fix(package_json): stop stripping raw_json fields (keep all) Jun 4, 2026
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.

1 participant