OverviewFilesCommitsIssuesDocsReleasesPeers

pgh / test / bench / scenarios / warm-update-noop.scenario.js

33 lines · javascript ref:
/**
 * warm-update-noop — re-install with everything cached.
 *
 * Measures fixed overhead per `pgh app install`: resolve, materialize,
 * launcher-write, teardown. NO bytes should cross the wire.
 *
 * Bottleneck this scenario surfaces: B5 (materialize at 409 deps does
 * a lot of fs work even when nothing changed).
 */

import { publishFixture, installByName, clearApp } from './_lib.js'

const fixture = process.env.FIXTURE || 'bench-medium'

export const name = 'warm-update-noop/' + fixture
export const description = 'reinstall with full tree-store cache hit'

export async function setup (ctx) {
  const { lockfile } = await publishFixture(ctx, fixture)
  ctx._lockfile = lockfile
  ctx.emit('fixture', fixture)
  // Warm-up install — bytes go to disk now. NOT counted in the timed phase.
  await installByName(ctx, lockfile, fixture)
  // Wipe the install dir but KEEP the tree store full.
  clearApp(ctx, fixture)
}

export async function run (ctx) {
  // Reset metrics so we measure ONLY the second install.
  ctx.metrics.install_duration_ms = null
  await installByName(ctx, ctx._lockfile, fixture)
}