perf(pm): cap install worker pressure#2996
Conversation
There was a problem hiding this comment.
Code Review
This pull request reduces the concurrency and worker limits for installation tasks, capping them at a maximum of 4. The changes affect the clone_worker_limit and extract_concurrency_limit functions, and the unit tests have been updated accordingly. A review comment suggests simplifying the clone_worker_limit implementation, as the current logic is unnecessarily complex and mathematically equivalent to a simple clamp operation.
| clone_limit | ||
| .saturating_div(2) | ||
| .saturating_add(2) | ||
| .clamp(1, clone_limit.max(1)) | ||
| .clamp(1, clone_limit.clamp(1, 4)) |
There was a problem hiding this comment.
The logic in clone_worker_limit has become unnecessarily complex with the nested clamping. Since the goal is to cap the worker limit at 4 while ensuring it doesn't exceed the total clone_limit (and stays at least 1), the entire expression is mathematically equivalent to clone_limit.clamp(1, 4).
For all
| clone_limit | |
| .saturating_div(2) | |
| .saturating_add(2) | |
| .clamp(1, clone_limit.max(1)) | |
| .clamp(1, clone_limit.clamp(1, 4)) | |
| clone_limit.clamp(1, 4) |
|
Closing this draft as a negative experiment: the GHA AB regressed p0 and p3 versus #2989, so the worker cap should not be integrated as-is. |
📊 pm-bench-phases ·
|
| PM | wall | ±σ | user | sys | RSS | pgMinor |
|---|---|---|---|---|---|---|
| bun | 15.43s | 2.74s | 9.92s | 9.81s | 571M | 323.4K |
| utoo-next | 10.44s | 0.51s | 10.70s | 13.08s | 984M | 119.6K |
| utoo-npm | 13.02s | 2.75s | 10.95s | 13.37s | 976M | 121.0K |
| utoo | 0.00s | 0.00s | 7.28s | 6.23s | 795M | 117.0K |
| PM | vCtx | iCtx | netRX | netTX | cache | node_mod | lock |
|---|---|---|---|---|---|---|---|
| bun | 34.0K | 12.0K | 1.19G | 7M | 1.86G | 1.75G | 1M |
| utoo-next | 169.1K | 114.6K | 1.16G | 6M | 1.71G | 1.70G | 2M |
| utoo-npm | 184.2K | 128.3K | 1.16G | 6M | 1.71G | 1.70G | 2M |
| utoo | 37.3K | 17.5K | 688M | 5M | 958M | 952M | - |
p1_resolve
| PM | wall | ±σ | user | sys | RSS | pgMinor |
|---|---|---|---|---|---|---|
| bun | 10.26s | 3.29s | 3.70s | 1.14s | 465M | 217.5K |
| utoo-next | 6.62s | 1.91s | 5.72s | 2.28s | 610M | 88.0K |
| utoo-npm | 8.01s | 2.24s | 5.80s | 2.26s | 597M | 81.4K |
| utoo | 8.49s | 1.95s | 6.11s | 1.73s | 632M | 120.7K |
| PM | vCtx | iCtx | netRX | netTX | cache | node_mod | lock |
|---|---|---|---|---|---|---|---|
| bun | 19.8K | 1.6K | 202M | 3M | 107M | - | 1M |
| utoo-next | 98.0K | 79.6K | 200M | 3M | 7M | 3M | 2M |
| utoo-npm | 100.7K | 79.3K | 200M | 3M | 7M | 3M | 2M |
| utoo | 21.6K | 18.6K | 201M | 3M | 7M | 3M | 2M |
p3_cold_install
| PM | wall | ±σ | user | sys | RSS | pgMinor |
|---|---|---|---|---|---|---|
| bun | 9.66s | 4.94s | 6.41s | 10.11s | 425M | 184.1K |
| utoo-next | 13.40s | 2.25s | 5.15s | 11.38s | 424M | 61.3K |
| utoo-npm | 11.41s | 1.54s | 5.25s | 11.35s | 442M | 60.4K |
| utoo | 10.02s | 1.61s | 5.14s | 9.54s | 462M | 52.3K |
| PM | vCtx | iCtx | netRX | netTX | cache | node_mod | lock |
|---|---|---|---|---|---|---|---|
| bun | 10.4K | 9.8K | 1014M | 5M | 1.76G | 1.76G | 1M |
| utoo-next | 140.0K | 52.7K | 990M | 4M | 1.70G | 1.70G | 2M |
| utoo-npm | 135.0K | 62.3K | 990M | 4M | 1.70G | 1.70G | 2M |
| utoo | 79.2K | 44.5K | 990M | 4M | 1.70G | 1.70G | 2M |
p4_warm_link
| PM | wall | ±σ | user | sys | RSS | pgMinor |
|---|---|---|---|---|---|---|
| bun | 3.36s | 0.07s | 0.20s | 2.34s | 135M | 33.4K |
| utoo-next | 2.53s | 0.15s | 0.52s | 3.77s | 79M | 18.1K |
| utoo-npm | 2.34s | 0.05s | 0.48s | 3.77s | 78M | 17.9K |
| utoo | 2.17s | 0.05s | 0.34s | 3.32s | 50M | 11.1K |
| PM | vCtx | iCtx | netRX | netTX | cache | node_mod | lock |
|---|---|---|---|---|---|---|---|
| bun | 547 | 24 | 5M | 21K | 1.91G | 1.73G | 1M |
| utoo-next | 41.8K | 18.7K | 7K | 10K | 1.70G | 1.70G | 2M |
| utoo-npm | 40.4K | 17.3K | 6K | 5K | 1.70G | 1.70G | 2M |
| utoo | 8.1K | 4.5K | 7K | 9K | 1.71G | 1.70G | 2M |
npmmirror.com: no output captured.
Summary
Experiment for p3 cold install scheduling pressure.
Verification
GHA Benchmark
Conclusion: negative on GHA; do not integrate as-is.
Compared with #2989 latest Linux/npmjs run (
26102983933), this worker-cap experiment (26105816781) regresses p0 and p3:The cap can improve one high-ctx internal environment, but GHA does not support making it the default.