Skip to content

[benchmark] lock file resolution#14764

Draft
edmundhung wants to merge 1 commit into
mainfrom
edmundhung/benchmark-lockfile-resolution-ci
Draft

[benchmark] lock file resolution#14764
edmundhung wants to merge 1 commit into
mainfrom
edmundhung/benchmark-lockfile-resolution-ci

Conversation

@edmundhung

Copy link
Copy Markdown
Member

Fixes #[insert GH or internal issue link(s)].

Trying to get a sense of the additional cost for resolving from lockfile in #14703


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because:

A picture of a cute animal (not mandatory, but encouraged)

@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4ee03ac

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This adds a fixtures/lockfile-resolution-benchmark fixture that spawns the workspace Wrangler and a pkg.pr.new prerelease from #14703 to compare dry-run deploy timings.

Ranked issues:

  1. (medium) The benchmark's test:ci wires into the main CI graph on all 3 OSes, permanently pulling a pkg.pr.new prerelease and running ~12 wrangler spawns per CI run — surprising for a one-off measurement PR.
  2. (low) summarize computes the median incorrectly for even-length inputs; safe at trials = 5 today but silently wrong if trials is bumped to an even number.

Details inline.

const sorted = values.toSorted((a, b) => a - b);
return {
min: sorted[0],
median: sorted[Math.floor(sorted.length / 2)],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

median only picks a single element, so for an even number of trials it returns the upper-middle value rather than the average of the two middle values. Harmless while trials = 5 (odd), but the whole point of this fixture is accurate stats, so it's worth making it robust in case trials changes:

Suggested change
median: sorted[Math.floor(sorted.length / 2)],
median:
sorted.length % 2 === 0
? (sorted[sorted.length / 2 - 1] + sorted[sorted.length / 2]) / 2
: sorted[Math.floor(sorted.length / 2)],

[#14703](https://github.com/cloudflare/workers-sdk/pull/14703).

Its `test:ci` script warms both CLIs, runs five alternating trials, and prints a
single timing summary. The fixture test suite runs automatically on Linux,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This documents that the benchmark runs automatically in the main CI workflow on all three OSes. Because test:ci is the standard CI task, every CI run will now fetch the pkg.pr.new prerelease (wrangler-pr) and spawn wrangler ~12 times on Linux/macOS/Windows. That's a real recurring cost and an external network dependency (pkg.pr.new) baked into pnpm-lock.yaml/the catalog. Given the [benchmark] title and the exploratory PR body, this looks like a one-off measurement that shouldn't be merged into main permanently — consider dropping it before merge, or gating the script so it's opt-in (e.g. behind an env flag) rather than part of the default CI graph.

@ask-bonk

ask-bonk Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully to PR #14764.

Summary of what I flagged:

  1. (medium) The benchmark's test:ci is wired into the standard CI graph on all 3 OSes, permanently fetching a pkg.pr.new prerelease and running ~12 wrangler spawns per CI run — an external network dependency and recurring cost baked into the lockfile for what reads as a one-off measurement PR. Suggested dropping it before merge or gating it behind an opt-in flag.
  2. (low) summarize computes the median incorrectly for even-length inputs (picks the upper-middle element instead of averaging the two middle values). Safe at trials = 5, but silently wrong if trials changes — posted a suggestion to make it robust.

github run

@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14764

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14764

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14764

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14764

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14764

miniflare

npm i https://pkg.pr.new/miniflare@14764

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14764

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14764

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14764

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14764

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14764

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14764

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14764

wrangler

npm i https://pkg.pr.new/wrangler@14764

commit: 4ee03ac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants