refactor(pacquet): remove redundant Arc#12461
Conversation
…t extender The built-in `@yarnpkg/extensions` compatibility database is built once per process and cached in a `OnceLock`. Wrapping it in an `Arc` added an allocation plus per-install refcount churn for no benefit: a `OnceLock` already hands out a stable `&'static` reference, and every consumer (`PackageExtender::apply` / `apply_to_arc`, both `&self`) is satisfied by `&'static PackageExtender` — which is `Copy + Send + Sync + 'static` and so moves cleanly into the resolver's `ManifestHook` closure. Store the extender as `OnceLock<PackageExtender>` returning a `&'static` reference. The per-install user-provided extender keeps its `Arc`, since it is constructed fresh each install and shared into the resolver hook.
`upload` only reads through the writer — a single `queue_side_effects_upload` call, no `Arc::clone` — so it never needed shared ownership. Borrowing `&Arc<StoreIndexWriter>` forced the signature to advertise reference counting it does not use. Take `&StoreIndexWriter` instead; the sole caller passes a `&Arc<StoreIndexWriter>` that deref-coerces at the call site, so it is unchanged.
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
ArcArc
Fast-forward was not possible: both sides diverged from 7c97d9e (2 local commits removing redundant Arc usage, 15 commits from main). The merge is conflict-free — of main's new commits, only #12449 (install --dry-run) touched install_with_fresh_lockfile.rs, in a region disjoint from the compat-extender change.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12461 +/- ##
=======================================
Coverage 88.08% 88.08%
=======================================
Files 310 310
Lines 41863 41860 -3
=======================================
- Hits 36874 36872 -2
+ Misses 4989 4988 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Micro-Benchmark ResultsLinux |
Integrated-Benchmark Report (Linux)Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.28285925556,
"stddev": 0.17710622725463798,
"median": 4.3379893455600005,
"user": 3.8682865200000003,
"system": 3.5033182599999995,
"min": 4.00792249006,
"max": 4.55762914606,
"times": [
4.40972523006,
4.42168863906,
4.057084752060001,
4.55762914606,
4.372673300060001,
4.36530352106,
4.00792249006,
4.310675170060001,
4.14758292906,
4.17830737806
]
},
{
"command": "pacquet@main",
"mean": 4.067451137659999,
"stddev": 0.11490841154821103,
"median": 4.03039711306,
"user": 3.90138032,
"system": 3.4372450599999995,
"min": 3.9363725580600004,
"max": 4.29539260806,
"times": [
4.14687917206,
3.94717368606,
4.03471434606,
4.01493090506,
4.29539260806,
4.18705523606,
4.02607988006,
4.10570333506,
3.9363725580600004,
3.9802096500600004
]
},
{
"command": "pnpr@HEAD",
"mean": 2.0568267784600005,
"stddev": 0.0684598355468969,
"median": 2.03886964356,
"user": 2.62006942,
"system": 2.9423892599999997,
"min": 1.96521003106,
"max": 2.1779093780600003,
"times": [
2.03007108806,
2.02736902106,
1.98322605206,
2.0476681990600003,
2.0300592490600002,
2.1779093780600003,
2.15935518706,
1.96521003106,
2.0626641140600004,
2.08473546506
]
},
{
"command": "pnpr@main",
"mean": 2.1727942232600004,
"stddev": 0.14665008707567873,
"median": 2.2140458155600005,
"user": 2.6438168200000005,
"system": 2.9475975599999997,
"min": 1.9890286250600002,
"max": 2.36677169906,
"times": [
2.30681869006,
2.24358522706,
2.36677169906,
2.0014515220600004,
2.05540448806,
1.9890286250600002,
2.0027206910600004,
2.28348968506,
2.1845064040600004,
2.29416520106
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6368254938600001,
"stddev": 0.011385396800974676,
"median": 0.6340272731600001,
"user": 0.37779854,
"system": 1.32514074,
"min": 0.62471414516,
"max": 0.65811861116,
"times": [
0.62471414516,
0.63615524516,
0.65436574216,
0.6281502951600001,
0.65811861116,
0.63189930116,
0.6307023511600001,
0.62672985816,
0.6362184521600001,
0.64120093716
]
},
{
"command": "pacquet@main",
"mean": 0.61868114366,
"stddev": 0.012803441507270873,
"median": 0.6206010496600001,
"user": 0.35163263999999994,
"system": 1.31562494,
"min": 0.60169684416,
"max": 0.6413142081600001,
"times": [
0.6413142081600001,
0.62607464816,
0.6243464641600001,
0.6305265801600001,
0.60783126016,
0.60228447516,
0.61153485716,
0.60169684416,
0.62172902616,
0.61947307316
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7086144196600002,
"stddev": 0.11112310468186078,
"median": 0.6746431726600001,
"user": 0.39896334,
"system": 1.34323224,
"min": 0.6552511241600001,
"max": 1.02333985216,
"times": [
0.6744510811600001,
0.6753672671600001,
0.65831938416,
0.67188469516,
0.68849867816,
0.6552511241600001,
0.6748352641600001,
0.6739645471600001,
1.02333985216,
0.6902323031600001
]
},
{
"command": "pnpr@main",
"mean": 0.66608321166,
"stddev": 0.01770253429169027,
"median": 0.6670849861600001,
"user": 0.36913654000000007,
"system": 1.3204365399999998,
"min": 0.63879364916,
"max": 0.70101590016,
"times": [
0.70101590016,
0.66381258716,
0.6776465781600001,
0.67058062616,
0.63879364916,
0.6642602631600001,
0.66990970916,
0.64665293516,
0.65198068816,
0.67617918016
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.15635587068,
"stddev": 0.0510286245967059,
"median": 4.14711685428,
"user": 3.6913308999999996,
"system": 3.3103325200000002,
"min": 4.03825380128,
"max": 4.21345350228,
"times": [
4.03825380128,
4.14524086628,
4.14244928828,
4.19846836728,
4.21345350228,
4.14532422928,
4.20814620028,
4.14890947928,
4.13694747428,
4.18636549828
]
},
{
"command": "pacquet@main",
"mean": 4.19162973918,
"stddev": 0.04392325516843144,
"median": 4.19021507078,
"user": 3.7282649,
"system": 3.3299576199999996,
"min": 4.11167182528,
"max": 4.27198124128,
"times": [
4.22191955828,
4.16539390428,
4.21609990928,
4.21473047128,
4.1848822092799995,
4.27198124128,
4.19554793228,
4.18292143728,
4.15114890328,
4.11167182528
]
},
{
"command": "pnpr@HEAD",
"mean": 2.15408358408,
"stddev": 0.11077770407293812,
"median": 2.1116737897799998,
"user": 2.4659166999999997,
"system": 2.8611935199999996,
"min": 2.02079263328,
"max": 2.33060102528,
"times": [
2.06247215328,
2.07467336928,
2.1266888382799998,
2.27580381028,
2.19885997228,
2.02079263328,
2.28869871628,
2.0966587412799997,
2.33060102528,
2.06558658128
]
},
{
"command": "pnpr@main",
"mean": 2.23493069238,
"stddev": 0.10094148511486734,
"median": 2.25809773628,
"user": 2.4434422999999996,
"system": 2.8649908199999996,
"min": 2.04838967228,
"max": 2.41554083328,
"times": [
2.24480461728,
2.30433541628,
2.27990994628,
2.04838967228,
2.28260356428,
2.41554083328,
2.16064083728,
2.27139085528,
2.16833531728,
2.17335586428
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3084609020999998,
"stddev": 0.009124420780542795,
"median": 1.3072077003,
"user": 1.3239701,
"system": 1.6888832399999998,
"min": 1.2956962512999999,
"max": 1.3302260273,
"times": [
1.3102013493,
1.3050752413,
1.3302260273,
1.3035386833,
1.3093401593,
1.3125055013,
1.3045766733,
1.2956962512999999,
1.3025014413,
1.3109476933
]
},
{
"command": "pacquet@main",
"mean": 1.3460057094,
"stddev": 0.07941684259194534,
"median": 1.3234512038,
"user": 1.3092487999999998,
"system": 1.6929558399999998,
"min": 1.3080354423,
"max": 1.5710005933,
"times": [
1.3200369523,
1.3080354423,
1.3243907433,
1.5710005933,
1.3358676532999998,
1.3238208933,
1.3230815142999999,
1.3141103393,
1.3147600093,
1.3249529533
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6442015105000001,
"stddev": 0.00901041623655475,
"median": 0.6449132353,
"user": 0.3396371,
"system": 1.2650700400000001,
"min": 0.6306305113,
"max": 0.6586857723,
"times": [
0.6530092163000001,
0.6414537483,
0.6332864703000001,
0.6474224903000001,
0.6499664343,
0.6424039803,
0.6489165523,
0.6362399293000001,
0.6586857723,
0.6306305113
]
},
{
"command": "pnpr@main",
"mean": 0.6304444915000001,
"stddev": 0.0057953789523157865,
"median": 0.6311902073,
"user": 0.3222256,
"system": 1.2609196399999998,
"min": 0.6201021363000001,
"max": 0.6397653753000001,
"times": [
0.6351959793,
0.6201021363000001,
0.6316828103000001,
0.6299331423000001,
0.6310683393000001,
0.6228579883,
0.6397653753000001,
0.6347293993,
0.6277976693,
0.6313120753
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.9434400149399997,
"stddev": 0.03840571955064701,
"median": 2.93280462494,
"user": 1.7725612800000001,
"system": 1.9237859400000001,
"min": 2.90285065344,
"max": 3.03558170044,
"times": [
2.93429920044,
2.93131004944,
2.9287016064399998,
2.93714988744,
2.9546379414399997,
2.92096317844,
2.91269390144,
2.9762120304399997,
3.03558170044,
2.90285065344
]
},
{
"command": "pacquet@main",
"mean": 2.9708423342399994,
"stddev": 0.03113106684932971,
"median": 2.9657844864399996,
"user": 1.73562918,
"system": 1.95960994,
"min": 2.93654931244,
"max": 3.0406599284399998,
"times": [
2.9571487094399997,
2.9800904074399996,
2.97442026344,
2.93654931244,
2.98072813344,
2.95123403244,
2.93810562044,
2.99476337844,
3.0406599284399998,
2.95472355644
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6654227825400001,
"stddev": 0.014907189642944428,
"median": 0.6664722729400001,
"user": 0.3515861800000001,
"system": 1.29465864,
"min": 0.64027805644,
"max": 0.69143926444,
"times": [
0.69143926444,
0.6777682954400001,
0.65176378544,
0.66805545044,
0.6784501524400001,
0.6536919534400001,
0.6679312434400001,
0.65983632144,
0.64027805644,
0.66501330244
]
},
{
"command": "pnpr@main",
"mean": 0.64374691204,
"stddev": 0.017516695829307,
"median": 0.64044167294,
"user": 0.33116698,
"system": 1.2677123399999999,
"min": 0.6198348154400001,
"max": 0.6853530024400001,
"times": [
0.64140208344,
0.6381651514400001,
0.63829357344,
0.63948126244,
0.62722713044,
0.6198348154400001,
0.6515099694400001,
0.6493221464400001,
0.6853530024400001,
0.64687998544
]
}
]
} |
|
| Branch | pr/12461 |
| Testbed | pacquet |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result milliseconds (ms) (Result Δ%) | Upper Boundary milliseconds (ms) (Limit %) |
|---|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,156.36 ms(-0.53%)Baseline: 4,178.67 ms | 5,014.41 ms (82.89%) |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot 🚷 view threshold | 2,943.44 ms(-1.64%)Baseline: 2,992.57 ms | 3,591.08 ms (81.97%) |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 1,308.46 ms(-0.21%)Baseline: 1,311.15 ms | 1,573.38 ms (83.16%) |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,282.86 ms(+5.03%)Baseline: 4,077.75 ms | 4,893.31 ms (87.52%) |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 636.83 ms(+3.79%)Baseline: 613.54 ms | 736.25 ms (86.50%) |
|
| Branch | pr/12461 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,154.08 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 665.42 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 644.20 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,056.83 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 708.61 ms |
ArcArc
PR Summary by QodoRefactor(pacquet): remove redundant Arc around global compat extender Description
Diagram
High-Level Assessment
Files changed (3)
|
Summary by CodeRabbit