mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #914] [CLOSED] fix(dev): show sane compile times when worker uses wall-clock performance.now() #944
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#944
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/914
Author: @james-elicx
Created: 4/26/2026
Status: ❌ Closed
Base:
main← Head:claude/interesting-curie-b7ddb9📝 Commits (4)
609beddfix(dev): show sane compile times when worker uses wall-clock performance.now()7fcebcafix(dev): use Date.now() for request timing to dodge workerd performance.now() origin72e5c96fix(dev): drop NODE_ENV gate on __reqStart so it matches compileEnd capture3b866b2fix(dev): derive compileMs from totalMs - renderMs to dodge workerd Spectre clock📊 Changes
5 files changed (+49 additions, -53 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+8 -4)📝
packages/vinext/src/index.ts(+19 -41)📝
packages/vinext/src/server/app-page-render.ts(+3 -2)📝
packages/vinext/src/server/app-page-response.ts(+15 -4)📝
tests/app-page-response.test.ts(+4 -2)📄 Description
Summary
compile: 1777234570.6s(and similar absurd values) for App Router requests.performance.now()returns wall-clock time since epoch, but Node'sperformance.now()is process-uptime. The middleware subtracted the worker'shandlerStartfrom the Node_reqStartto attribute Vite-transform overhead to "compile" — across two different time origins.handlerStarttimestamp across the worker→Node boundary. TheX-Vinext-Timingheader now carries only durations (compileMs,renderMs) computed inside the worker against a single clock. The Node middleware uses those values directly.Tradeoff: we no longer attribute pre-handler Vite transform time to the "compile" metric. That overhead is mostly first-request module transforms and is already visible in Vite's own logs; the in-handler compile delta (dynamic module loading) is the dominant component and remains accurate.
Test plan
pnpm test:unit— all 3049 tests pass, including the updatedapp-page-responseheader-format assertions.vinext devagainst an App Router app on Cloudflare and confirmcompile:values are in the ms / sub-second range.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.