Skip to content

perf(pm): skip lifecycle reads when scripts are ignored#2968

Closed
elrrrrrrr wants to merge 1 commit into
perf/pm-resolver-demand-bfsfrom
exp/pm-ignore-scripts-skip-lifecycle-read-b33d922
Closed

perf(pm): skip lifecycle reads when scripts are ignored#2968
elrrrrrrr wants to merge 1 commit into
perf/pm-resolver-demand-bfsfrom
exp/pm-ignore-scripts-skip-lifecycle-read-b33d922

Conversation

@elrrrrrrr
Copy link
Copy Markdown
Contributor

Summary

  • skip package lifecycle-script reads during rebuild when install runs with --ignore-scripts
  • keep binary linking behavior unchanged
  • add coverage that ignore mode does not populate lifecycle scripts

Hypothesis

p3/p4 benchmark runs use utoo install --ignore-scripts. Rebuild currently still reads package.json for packages marked with hasInstallScript, even though those scripts cannot run. Avoiding those reads should reduce warm-link filesystem work and async scheduling overhead.

Validation

  • cargo fmt
  • cargo test -p utoo-pm service::package::tests::test_collect_packages_from_lock_with_scripts
  • cargo clippy -p utoo-pm --all-targets -- -D warnings --no-deps

Benchmark Plan

@elrrrrrrr elrrrrrrr added A-Pkg Manager Area: Package Manager benchmark Run pm-bench on PR labels May 18, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refines the logic for reading lifecycle scripts in the PackageService by ensuring they are only loaded when the script policy is set to Run and scripts are actually present. Additionally, it includes a new test assertion to verify that ignored scripts are correctly excluded from being read. I have no feedback to provide.

@github-actions
Copy link
Copy Markdown

📊 pm-bench-phases · 16146fb · linux (ubuntu-latest)

Workflow run — ant-design

PMs: utoo (this branch) · utoo-npm (latest published) · bun (latest)

npmjs.org

p0_full_cold

PM wall ±σ user sys RSS pgMinor
bun 9.62s 0.35s 10.50s 10.08s 658M 303.8K
utoo-next 8.09s 0.31s 10.61s 12.19s 990M 128.5K
utoo-npm 7.93s 0.32s 10.77s 12.16s 983M 124.5K
utoo 7.91s 0.19s 11.48s 12.20s 968M 150.3K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 19.0K 19.2K 1.20G 7M 1.90G 1.77G 1M
utoo-next 128.6K 92.0K 1.17G 5M 1.73G 1.72G 2M
utoo-npm 127.5K 93.3K 1.17G 5M 1.73G 1.72G 2M
utoo 119.0K 92.2K 1.17G 6M 1.72G 1.72G 2M

p1_resolve

PM wall ±σ user sys RSS pgMinor
bun 2.29s 0.05s 4.03s 1.20s 490M 191.7K
utoo-next 3.26s 0.05s 5.42s 2.32s 613M 79.9K
utoo-npm 3.33s 0.02s 5.42s 2.33s 610M 75.8K
utoo 2.52s 0.10s 6.08s 1.75s 663M 122.5K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 11.7K 4.1K 204M 3M 108M - 1M
utoo-next 83.1K 91.4K 201M 3M 7M 3M 2M
utoo-npm 82.5K 96.4K 201M 3M 7M 3M 2M
utoo 16.8K 22.3K 204M 3M 7M 3M 2M

p3_cold_install

PM wall ±σ user sys RSS pgMinor
bun 6.69s 0.23s 6.42s 9.82s 590M 202.7K
utoo-next 6.85s 1.17s 5.16s 10.56s 431M 58.1K
utoo-npm 6.03s 0.20s 5.25s 10.45s 496M 63.1K
utoo 6.74s 1.50s 5.25s 10.80s 495M 61.8K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 6.4K 8.3K 1.00G 4M 1.77G 1.77G 1M
utoo-next 108.8K 51.4K 999M 3M 1.72G 1.72G 2M
utoo-npm 94.9K 46.8K 999M 2M 1.72G 1.72G 2M
utoo 121.6K 79.0K 999M 3M 1.72G 1.72G 2M

p4_warm_link

PM wall ±σ user sys RSS pgMinor
bun 3.42s 0.03s 0.20s 2.43s 135M 32.2K
utoo-next 2.52s 0.24s 0.50s 3.82s 80M 18.3K
utoo-npm 2.27s 0.09s 0.50s 3.78s 80M 18.2K
utoo 2.40s 0.08s 0.53s 3.86s 63M 14.3K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 276 23 5M 49K 1.93G 1.76G 1M
utoo-next 40.1K 18.3K 324K 15K 1.72G 1.72G 2M
utoo-npm 39.6K 17.5K 317K 12K 1.72G 1.72G 2M
utoo 52.8K 24.8K 317K 9K 1.73G 1.72G 2M

npmmirror.com: no output captured.

@elrrrrrrr
Copy link
Copy Markdown
Contributor Author

GHA run 1 read

Run: https://github.com/utooland/utoo/actions/runs/26016519226

phase utoo wall utoo ctx same-run utoo-next same-run utoo-npm same-run bun read
p3_cold_install 6.74s ±1.50 121.6K / 79.0K 6.85s, 108.8K / 51.4K 6.03s, 94.9K / 46.8K 6.69s, 6.4K / 8.3K no ctx win; iCtx regresses materially
p4_warm_link 2.40s ±0.08 52.8K / 24.8K 2.52s, 40.1K / 18.3K 2.27s, 39.6K / 17.5K 3.42s, 276 / 23 not positive; p4 ctx is worse than same-run next/npm

Conclusion: reject this single-factor experiment. Skipping lifecycle package.json reads under --ignore-scripts is correct-looking but not a measurable p3/p4 lever in this benchmark. Do not fold unless a later combined change proves it is needed for correctness rather than perf.

@elrrrrrrr
Copy link
Copy Markdown
Contributor Author

Closing this PM performance experiment after the investigation phase. The benchmark data and conclusions are preserved in the PR body/comments; we will split the validated pieces into smaller reviewable PRs for the formal ship path.

@elrrrrrrr elrrrrrrr closed this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Pkg Manager Area: Package Manager benchmark Run pm-bench on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant