Repository navigation
test(benchmark): cover concurrent integrity extraction - #13433
Conversation
📝 WalkthroughWalkthroughThe micro-benchmark adds gzip and async coordination dependencies, generates multiple tarballs, and benchmarks their concurrent download and storage alongside existing benchmarks. ChangesConcurrent tarball benchmarking
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoAdd concurrent cold-store tarball extraction Criterion benchmark
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Confidence Score: 5/5The benchmark-only changes appear safe to merge, with no concrete defects identified. The generated package metadata is consistent with the tarball contents, each measured iteration uses a fresh store, and the concurrent downloads are awaited before the result is consumed. Reviews (1): Last reviewed commit: "test(benchmark): cover concurrent integr..." | Re-trigger Greptile |
Micro-Benchmark ResultsLinux |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1. Leaked StoreDir allocations
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13433 +/- ##
=======================================
Coverage 87.60% 87.61%
=======================================
Files 545 545
Lines 93698 93746 +48
=======================================
+ Hits 82085 82134 +49
+ Misses 11613 11612 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pnpm/tasks/micro-benchmark/src/main.rs (2)
86-86: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAvoid recomputing
benchmark_filejust to read a constant length.
benchmark_filealways returns a fixed-size buffer (128 bytes), sounpacked_sizerelies on an implicit, undocumented invariant rather than an explicit constant. A named constant would be clearer and skip the redundant call.♻️ Proposed fix
+const BENCHMARK_FILE_SIZE: usize = 128; + fn benchmark_file(package_index: usize, file_index: usize) -> Vec<u8> { let prefix = format!("package={package_index};file={file_index};").into_bytes(); let mut content = - vec![u8::try_from((package_index + file_index) % 251).expect("value is below 251"); 128]; + vec![u8::try_from((package_index + file_index) % 251).expect("value is below 251"); BENCHMARK_FILE_SIZE]; content[..prefix.len()].copy_from_slice(&prefix); content }And at the call site:
- unpacked_size: BATCH_FILES_PER_TARBALL * benchmark_file(package_index, 0).len(), + unpacked_size: BATCH_FILES_PER_TARBALL * BENCHMARK_FILE_SIZE,Also applies to: 165-171
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/tasks/micro-benchmark/src/main.rs` at line 86, Replace the benchmark_file(...).len() usage when calculating unpacked_size with a named constant representing the fixed 128-byte benchmark file size, and reuse that constant at the other affected call sites around the related size calculations. Define the constant near benchmark_file so the invariant is explicit and avoid recomputing benchmark_file solely to obtain its length.
106-129: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winShare one
verified_files_cacheacross all concurrent tarball downloads.
SharedVerifiedFilesCacheisArc<DashSet<PathBuf>>, andDownloadTarballToStoreexpects the install-scoped cache to be a single reused handle. Creating it insidepackages.iter().map(...)gives this 256-task workload independent caches, so no concurrent integrity stat/cache checks actually contend on the shared in-flight state.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pnpm/tasks/micro-benchmark/src/main.rs` around lines 106 - 129, Move the SharedVerifiedFilesCache initialization outside the packages.iter().map concurrent download closure, then clone and reuse that single handle for each DownloadTarballToStore instance. Keep the existing cache field wiring intact while ensuring all downloads share the same install-scoped cache.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pnpm/tasks/micro-benchmark/src/main.rs`:
- Line 86: Replace the benchmark_file(...).len() usage when calculating
unpacked_size with a named constant representing the fixed 128-byte benchmark
file size, and reuse that constant at the other affected call sites around the
related size calculations. Define the constant near benchmark_file so the
invariant is explicit and avoid recomputing benchmark_file solely to obtain its
length.
- Around line 106-129: Move the SharedVerifiedFilesCache initialization outside
the packages.iter().map concurrent download closure, then clone and reuse that
single handle for each DownloadTarballToStore instance. Keep the existing cache
field wiring intact while ensuring all downloads share the same install-scoped
cache.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6f2d0a34-a742-4003-8e20-bc05fc8de6fd
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (2)
pnpm/tasks/micro-benchmark/Cargo.tomlpnpm/tasks/micro-benchmark/src/main.rs
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5042148097799997,
"stddev": 0.133481263686539,
"median": 2.45624143378,
"user": 1.66692738,
"system": 1.33975826,
"min": 2.38917665128,
"max": 2.73828110528,
"times": [
2.40201278028,
2.73474259428,
2.50134978228,
2.55969473928,
2.41318947928,
2.45749018628,
2.45499268128,
2.73828110528,
2.39121809828,
2.38917665128
]
},
{
"command": "pacquet@main",
"mean": 2.52271491568,
"stddev": 0.14025055727687066,
"median": 2.4688723052799997,
"user": 1.64689278,
"system": 1.34794316,
"min": 2.38414773528,
"max": 2.79343583328,
"times": [
2.61236507928,
2.47203508528,
2.42735002728,
2.79343583328,
2.65382795528,
2.62963342828,
2.39450005828,
2.38414773528,
2.39414442928,
2.46570952528
]
},
{
"command": "pnpr@HEAD",
"mean": 1.54900296308,
"stddev": 0.1540837411476117,
"median": 1.49592943128,
"user": 1.1194273799999999,
"system": 1.14703916,
"min": 1.38194945328,
"max": 1.8069979812799999,
"times": [
1.8069979812799999,
1.39744975528,
1.46690119728,
1.48997349328,
1.68587109828,
1.53241753928,
1.38194945328,
1.78139924528,
1.44518449828,
1.50188536928
]
},
{
"command": "pnpr@main",
"mean": 1.66163086848,
"stddev": 0.13509851614031362,
"median": 1.73399076228,
"user": 1.21543138,
"system": 1.24849936,
"min": 1.41887225528,
"max": 1.79671183328,
"times": [
1.74948069728,
1.73490453428,
1.75421875428,
1.79671183328,
1.73307699028,
1.58852614628,
1.41887225528,
1.5166842362800002,
1.79223966528,
1.53159357228
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.28538266606,
"stddev": 0.021435102784943028,
"median": 0.27505953046000003,
"user": 0.22275434,
"system": 0.57431482,
"min": 0.26149994996000003,
"max": 0.33389809696000006,
"times": [
0.26982840696000004,
0.26149994996000003,
0.27450310396000005,
0.27494938396,
0.27500885496000005,
0.27511020596,
0.30395263496,
0.28615415596000005,
0.33389809696000006,
0.29892186696000006
]
},
{
"command": "pacquet@main",
"mean": 0.28371128516000005,
"stddev": 0.009922082338469152,
"median": 0.28505426896,
"user": 0.22328134,
"system": 0.5781035200000001,
"min": 0.25950746496000004,
"max": 0.29468641496000003,
"times": [
0.29303941896,
0.28484652896,
0.28925789096000004,
0.28526200896000004,
0.28710304096000006,
0.25950746496000004,
0.28112050396000005,
0.27747813696,
0.28481144196,
0.29468641496000003
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29965606696,
"stddev": 0.015743100278346495,
"median": 0.29901639046000006,
"user": 0.22839273999999996,
"system": 0.58431072,
"min": 0.26890007196000004,
"max": 0.32897303896,
"times": [
0.29064918596000006,
0.29388117196,
0.29259064596000006,
0.26890007196000004,
0.29404866696000004,
0.30796741196000005,
0.32897303896,
0.30561017096000004,
0.30995619096000004,
0.30398411396
]
},
{
"command": "pnpr@main",
"mean": 0.29650463636,
"stddev": 0.007417725495654021,
"median": 0.29885700546000005,
"user": 0.23339684000000002,
"system": 0.57192762,
"min": 0.28024496796000004,
"max": 0.30405670996000006,
"times": [
0.30125337096000004,
0.30405670996000006,
0.28024496796000004,
0.28903721496,
0.29259996396000004,
0.30324048496000006,
0.29824027596,
0.29947373496,
0.29566892296,
0.30123071696000003
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.10730358318,
"stddev": 0.1623835314585372,
"median": 3.0386210154800004,
"user": 2.5236554,
"system": 1.84859306,
"min": 2.9453531974800002,
"max": 3.41308806548,
"times": [
3.41308806548,
3.24331985148,
2.98282667648,
2.9453531974800002,
3.05930845648,
2.98735388548,
3.01793357448,
3.13818443648,
3.30931479248,
2.9763528954800003
]
},
{
"command": "pacquet@main",
"mean": 3.2557072258799997,
"stddev": 0.16268141593813537,
"median": 3.22714947948,
"user": 2.8531135,
"system": 2.02675126,
"min": 3.02502474348,
"max": 3.56752545248,
"times": [
3.1435240324800002,
3.22921501148,
3.1517397854800002,
3.13012980548,
3.26747348548,
3.02502474348,
3.22508394748,
3.40873386748,
3.56752545248,
3.40862212748
]
},
{
"command": "pnpr@HEAD",
"mean": 1.7176466301800002,
"stddev": 0.13209657367376554,
"median": 1.71610711748,
"user": 1.4152765999999999,
"system": 1.54272396,
"min": 1.54949958048,
"max": 1.9321470494800002,
"times": [
1.6062123214800001,
1.5979428484800002,
1.9061872344800002,
1.60836806348,
1.54949958048,
1.7797898704800001,
1.68074608048,
1.7514681544800002,
1.76410509848,
1.9321470494800002
]
},
{
"command": "pnpr@main",
"mean": 1.78926304298,
"stddev": 0.11780149085333183,
"median": 1.7815969804800003,
"user": 1.5037984999999998,
"system": 1.6786652600000003,
"min": 1.61822914048,
"max": 2.00466470948,
"times": [
1.7065479194800002,
2.00466470948,
1.7761885404800002,
1.79712347048,
1.83564280448,
1.6652105494800002,
1.75881507748,
1.61822914048,
1.9432027974800001,
1.78700542048
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7793287449000001,
"stddev": 0.04111644635724283,
"median": 0.7602550018,
"user": 0.9895761999999999,
"system": 0.8229633600000001,
"min": 0.7179124803,
"max": 0.8520826963,
"times": [
0.8006769543000001,
0.7607248903,
0.7581068693,
0.8069535703,
0.8290220613,
0.7532046953,
0.7179124803,
0.7548181183,
0.7597851133,
0.8520826963
]
},
{
"command": "pacquet@main",
"mean": 0.7381893554000001,
"stddev": 0.024297341806215827,
"median": 0.7392629052999999,
"user": 0.9302843,
"system": 0.78454516,
"min": 0.7072665503,
"max": 0.7750860223,
"times": [
0.7392673793,
0.7392584313,
0.7077989813,
0.7676378233,
0.7618398363000001,
0.7072665503,
0.7274745323,
0.7750860223,
0.7153625473,
0.7409014503
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3776695416,
"stddev": 0.023868236832822808,
"median": 0.37253474129999997,
"user": 0.273508,
"system": 0.62718396,
"min": 0.3399639613,
"max": 0.4135852693,
"times": [
0.3698980553,
0.4072838953,
0.4135852693,
0.3635478593,
0.3688730593,
0.3399639613,
0.3521527313,
0.3989078823,
0.3873112753,
0.37517142729999997
]
},
{
"command": "pnpr@main",
"mean": 0.3806328597,
"stddev": 0.01546744100999339,
"median": 0.3781423713,
"user": 0.2731385,
"system": 0.64795356,
"min": 0.3621999073,
"max": 0.4074409913,
"times": [
0.3660965203,
0.3788250943,
0.3690469053,
0.3882475143,
0.3913548763,
0.4074409913,
0.3621999073,
0.3994608013,
0.3661963383,
0.3774596483
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.00652392476,
"stddev": 0.058868226659212756,
"median": 1.99482492506,
"user": 1.1250037399999997,
"system": 0.80488114,
"min": 1.9526229640600001,
"max": 2.12796125706,
"times": [
2.12796125706,
2.07024926206,
1.9526229640600001,
1.9970738630600002,
1.99384505306,
2.05269089006,
1.99580479706,
1.96078102606,
1.95827759106,
1.95593254406
]
},
{
"command": "pacquet@main",
"mean": 2.10527348066,
"stddev": 0.08978314852157775,
"median": 2.08659469006,
"user": 1.2948525399999997,
"system": 0.9116561400000001,
"min": 1.98545955206,
"max": 2.2745599530600003,
"times": [
2.12967160206,
2.17625473906,
2.2745599530600003,
2.20158943906,
2.09163818506,
2.08155119506,
2.04051968306,
2.03851898306,
1.98545955206,
2.03297147506
]
},
{
"command": "pnpr@HEAD",
"mean": 0.34036931406000004,
"stddev": 0.03554865980028441,
"median": 0.32725129506000006,
"user": 0.23206633999999998,
"system": 0.56668584,
"min": 0.31532163606,
"max": 0.43171757506,
"times": [
0.32380592306000006,
0.31792562106000005,
0.31532163606,
0.32786537406000005,
0.31927032906,
0.32799969706000004,
0.34776937406,
0.32663721606,
0.43171757506,
0.36538039506000003
]
},
{
"command": "pnpr@main",
"mean": 0.33105152006000005,
"stddev": 0.012072770309717984,
"median": 0.32721813806,
"user": 0.21140983999999996,
"system": 0.59359154,
"min": 0.32034188306000005,
"max": 0.36017592306,
"times": [
0.32836788906000003,
0.32034188306000005,
0.32565730506,
0.34355527406,
0.32931893806000007,
0.32199681406,
0.32424682306,
0.36017592306,
0.32606838706,
0.33078596406000005
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.4544572307,
"stddev": 0.045330056280085206,
"median": 0.44269030600000003,
"user": 0.43818528,
"system": 0.07566031999999999,
"min": 0.4081887745,
"max": 0.5540191725,
"times": [
0.4648604705,
0.44441958150000005,
0.45766963450000003,
0.42052160350000006,
0.4081887745,
0.4337863865,
0.41318707950000005,
0.4409610305,
0.5069585735000001,
0.5540191725
]
},
{
"command": "pacquet@main",
"mean": 0.5002414413,
"stddev": 0.04712566323417656,
"median": 0.5188480799999999,
"user": 0.4806683799999999,
"system": 0.08233272,
"min": 0.42978076750000005,
"max": 0.5647099775000001,
"times": [
0.4364798985,
0.5211185765,
0.5204178705,
0.47264869750000005,
0.46279367350000006,
0.5553622485,
0.5172782895,
0.5647099775000001,
0.5218244135000001,
0.42978076750000005
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09594462733870968,
"stddev": 0.0044202789363791215,
"median": 0.09555461850000001,
"user": 0.024622273548387096,
"system": 0.013568136129032259,
"min": 0.0895313685,
"max": 0.10713426150000001,
"times": [
0.09045710750000001,
0.09677147550000001,
0.1008617025,
0.1003464545,
0.1010463795,
0.1036845285,
0.0979096945,
0.0999911165,
0.0978493305,
0.0956818675,
0.1020901515,
0.0972454865,
0.0952072055,
0.0990909845,
0.0937566885,
0.09555461850000001,
0.10713426150000001,
0.0941757775,
0.0930276595,
0.0990175365,
0.0947320015,
0.0958658335,
0.0900865605,
0.0910125415,
0.0913547145,
0.09199507750000001,
0.0923919035,
0.0901375665,
0.0925036345,
0.0895313685,
0.0937722185
]
},
{
"command": "pnpr@main",
"mean": 0.09193195985483868,
"stddev": 0.0026241034245832427,
"median": 0.0918439145,
"user": 0.024544725161290328,
"system": 0.00963063677419355,
"min": 0.0883182975,
"max": 0.1027777445,
"times": [
0.0918234155,
0.0911395195,
0.0935263465,
0.0893747025,
0.09253844950000001,
0.1027777445,
0.0952205595,
0.0906624135,
0.0907241795,
0.09263579250000001,
0.0931141515,
0.0946118765,
0.0910971415,
0.0932730205,
0.0895604815,
0.0883182975,
0.0924416275,
0.0901715815,
0.0884823455,
0.0919531885,
0.0929375595,
0.0907341285,
0.0918439145,
0.0925532875,
0.0928403065,
0.0906492485,
0.0909689285,
0.09115008050000001,
0.0884080075,
0.0923671875,
0.0919912715
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.761942149139999,
"stddev": 0.13246110819204282,
"median": 4.71922421344,
"user": 2.39647142,
"system": 1.8027642599999996,
"min": 4.61840173744,
"max": 5.07389129144,
"times": [
4.90565135444,
5.07389129144,
4.70527533644,
4.71548858144,
4.61840173744,
4.67471013944,
4.77039124244,
4.733845855439999,
4.72295984544,
4.69880610744
]
},
{
"command": "pacquet@main",
"mean": 4.59894299574,
"stddev": 0.08764086918851278,
"median": 4.58227934794,
"user": 2.23123072,
"system": 1.7104662599999998,
"min": 4.501163818439999,
"max": 4.7204233124399995,
"times": [
4.58176702244,
4.5130985704399995,
4.69732454444,
4.7204233124399995,
4.5222225394399995,
4.70094642544,
4.58279167344,
4.501163818439999,
4.51232771144,
4.65736433944
]
},
{
"command": "pnpr@HEAD",
"mean": 3.72646813344,
"stddev": 0.15335305420132,
"median": 3.67209380894,
"user": 1.77161402,
"system": 1.77959046,
"min": 3.53514946144,
"max": 3.9494015794400004,
"times": [
3.53514946144,
3.5851536684400003,
3.9494015794400004,
3.5886300614400004,
3.9127382894400005,
3.6497446214400004,
3.9168916374400005,
3.6570218104400003,
3.7827843974400004,
3.68716580744
]
},
{
"command": "pnpr@main",
"mean": 3.7090050105400003,
"stddev": 0.14013857366579877,
"median": 3.6519122364400003,
"user": 1.7418996200000003,
"system": 1.6294430599999998,
"min": 3.57419076744,
"max": 4.01357685944,
"times": [
3.70078291144,
4.01357685944,
3.6158779564400003,
3.80064374844,
3.5829319414400005,
3.65394286244,
3.64179388944,
3.64988161044,
3.57419076744,
3.8564275584400005
]
}
]
} |
Summary
Adds a Criterion benchmark for the integrity and extraction workload exposed by #13305.
The benchmark downloads 256 concurrent tarballs into cold stores. Each tarball contains 64 files, crossing the per-tarball parallel extraction threshold that is not exercised by the existing single-package integrity benchmark.
This is benchmark-only infrastructure and does not change either CLI implementation or a published package.
Squash Commit Body
Checklist
Written by an agent (Codex, GPT-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
New Features
Performance