perf(install): speed up frozen injected workspace installs (#16824)

Avoid replacing an injected directory when its regular files are still
hardlinked to the current source and its entries match. Keep the existing
refresh path for mismatches, links, forced imports and build isolation.
Preserve import reporting and add a frozen-repeat scenario to the existing
integrated benchmark and CI comparison.

Closes pnpm/tasks#121.
This commit is contained in:
Altay authored and GitHub committed 2026-10-10 19:16:11 +02:00
1 parent 581a17de66
commit c60133d86c
30 files changed
+875 -94

No files matched your search

@@ -13,6 +13,7 @@ export const scenarios = [
'ISOLATED_FRESH_RESOLVE_HOT_CACHE_OFFLINE',
'ISOLATED_PEER_HEAVY_RESOLVE_HOT_CACHE_OFFLINE',
'ISOLATED_LINKED_WORKSPACE_RESOLVE_HOT_CACHE_OFFLINE',
'ISOLATED_INJECTED_WORKSPACE_REPEAT_INSTALL_HOT_CACHE_HOT_STORE',
'ISOLATED_FRESH_RESTORE_COLD_CACHE_COLD_STORE_COLD_PNPR',
'GVS_FRESH_RESTORE_HOT_CACHE_HOT_STORE',
]
@@ -76,7 +77,7 @@ export async function renderComparison (directory) {
let failed = false
for (const scenario of scenarios) {
const report = JSON.parse(await readFile(join(directory, `BENCHMARK_REPORT_${scenario}.json`), 'utf8'))
const engines = scenario.includes('PEER_HEAVY') || scenario.includes('LINKED_WORKSPACE') ? ['pacquet'] : ['pacquet', 'pnpr']
const engines = scenario.includes('PEER_HEAVY') || scenario.includes('LINKED_WORKSPACE') || scenario.includes('INJECTED_WORKSPACE') ? ['pacquet'] : ['pacquet', 'pnpr']
for (const engine of engines) {
const result = compareConfirmed(report, engine)
failed ||= result.status === 'Regression'
@@ -73,7 +73,7 @@ test('all scenarios and both engines are checked, and missing reports fail', asy
try {
for (const scenario of scenarios) {
const input = report(stable, stable)
if (!scenario.includes('PEER_HEAVY') && !scenario.includes('LINKED_WORKSPACE')) {
if (!scenario.includes('PEER_HEAVY') && !scenario.includes('LINKED_WORKSPACE') && !scenario.includes('INJECTED_WORKSPACE')) {
input.results.push(command('pnpr@HEAD', Array(10).fill(1.4)), command('pnpr@main', stable))
}
input.confirmation = { results: input.results }
@@ -82,7 +82,7 @@ test('all scenarios and both engines are checked, and missing reports fail', asy
const result = await renderComparison(directory)
assert.equal(result.failed, true)
assert.equal(result.markdown.match(/\| Regression \|/g).length, 10)
assert.equal(result.markdown.match(/\| Within tolerance \|/g).length, 12)
assert.equal(result.markdown.match(/\| Within tolerance \|/g).length, 13)
const cli = new URL('./compare-integrated-benchmarks.mjs', import.meta.url)
const run = spawnSync(process.execPath, [fileURLToPath(cli), directory], { encoding: 'utf8' })
assert.equal(run.status, 1)