Skip to content

fix: normalize pnpm 12 package benchmark data - #168

Merged
darcyclarke merged 1 commit into
vltpkg:mainfrom
jdx:fix/pnpm12-package-normalization
Aug 28, 2026
Merged

fix: normalize pnpm 12 package benchmark data#168
darcyclarke merged 1 commit into
vltpkg:mainfrom
jdx:fix/pnpm12-package-normalization

Conversation

@jdx

@jdx jdx commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • recognize pnpm 12’s JSON-formatted .modules.yaml when attributing package counts
  • exclude results with missing counts from per-package charts instead of mixing seconds with milliseconds per package
  • normalize standard deviation to the same unit as the per-package mean
  • add regression coverage for pnpm 11 YAML, pnpm 12 JSON, missing counts, and timing normalization

Problem

pnpm 12 currently writes metadata like:

{
  "packageManager": "pnpm@12.0.0"
}

The benchmark expected the pnpm 11-style YAML form:

packageManager: pnpm@11.0.0

Consequently, pnpm 12 received no package count. The chart generator then left its total duration in seconds while comparing it against other results normalized to milliseconds per package.

For the published Svelte clean result, this made pnpm 12’s 1.034 total seconds appear comparable to Bun’s 10.79 milliseconds per package. With the correct 59-package count, pnpm 12 is approximately 17.53 ms/package.

Validation

  • node --test scripts/benchmark-data.test.js
  • shellcheck -s bash scripts/package-count.sh
  • npm run --prefix app lint
  • npm run --prefix app build
  • regenerated chart data from the published 2026-08-26 Svelte results, both with and without a pnpm 12 package count

AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.

@darcyclarke
darcyclarke disabled auto-merge August 28, 2026 15:51
@darcyclarke
darcyclarke merged commit deb2593 into vltpkg:main Aug 28, 2026
3 of 4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the benchmark ingestion pipeline to correctly attribute package counts for pnpm 12 (JSON-formatted .modules.yaml), and to make per-package chart data consistent by skipping entries with missing counts and normalizing stddev into the same units as the per-package mean.

Changes:

  • Extend package manager inference to recognize pnpm 12’s JSON .modules.yaml format.
  • Normalize timing (mean + stddev) to ms/package when counts are available; otherwise exclude missing-count results from per-package charts.
  • Add Node test coverage for pnpm 11 YAML vs pnpm 12 JSON metadata parsing and timing normalization behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
scripts/package-count.sh Broaden pnpm metadata parsing to detect pnpm 12 JSON and classify pacquet correctly.
scripts/generate-chart.js Centralize timing normalization, skip per-package entries with missing counts, export helper for tests, and guard CLI execution.
scripts/benchmark-data.test.js Add regression tests for timing normalization and pnpm metadata parsing via package-count script.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/package-count.sh
Comment on lines +25 to +28
# pnpm 11 writes YAML, while pnpm 12 currently writes JSON despite the
# .yaml extension. Accept both `packageManager: pnpm@11...` and
# `"packageManager": "pnpm@12..."`.
pnpm_major=$(sed -En 's/^[[:space:]]*"?packageManager"?[[:space:]]*:[[:space:]]*"?pnpm@([0-9]+).*/\1/p' node_modules/.modules.yaml 2>/dev/null | head -1)
Comment thread scripts/generate-chart.js
Comment on lines +57 to +76
const normalizeTiming = (result, count, perPackageCount) => {
if (!result || typeof result.mean !== "number") {
return undefined;
}

if (!perPackageCount) {
return { value: result.mean, stddev: result.stddev };
}

if (typeof count !== "number" || count <= 0) {
return undefined;
}

const scale = 1000 / count;
return {
value: result.mean * scale,
stddev:
typeof result.stddev === "number" ? result.stddev * scale : undefined,
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants