Skip to content

perf(cloudflare): reuse response-stage invocations - #3388

Merged
james-elicx merged 2 commits into
mainfrom
codex/response-store-lazy-invocation
Sep 22, 2026
Merged

james-elicx merged 2 commits into
mainfrom
codex/response-store-lazy-invocation

Conversation

@james-elicx

Copy link
Copy Markdown
Member

Summary

  • defer stored response-stage invocation serialization until a Response Store miss
  • sanitize props and collect replay headers once for cacheable dispatches
  • reuse the prepared invocation for cache identity, rendering context, and revalidation metadata
  • preserve standalone regeneration paths that must prepare their own invocation

Performance

Cache hits no longer serialize a stored replay invocation. Cache misses no longer deep-clone props three times or serialize the same stored invocation twice.

Validation

  • vp test run tests/cloudflare-response-store-worker.test.ts (3 passed)
  • vp test run tests/response-store-data.test.ts from packages/cloudflare (17 passed)
  • vp check packages/cloudflare/src/cache/response-store-adapter.worker.ts tests/cloudflare-response-store-worker.test.ts
  • vp run @vinext/cloudflare#build
  • git diff --check

This preserves Next.js-visible behavior and only changes Cloudflare adapter serialization work, so there is no corresponding Next.js test to port.

@pkg-pr-new

pkg-pr-new Bot commented Sep 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/@vinext/cloudflare@3388

create-vinext-app

npm i https://pkg.pr.new/create-vinext-app@3388

@vinext/types

npm i https://pkg.pr.new/@vinext/types@3388

vinext

npm i https://pkg.pr.new/vinext@3388

@cloudflare/workers-response-store

npm i https://pkg.pr.new/@cloudflare/workers-response-store@3388

commit: c7f6853

@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
workers-cache preview production
kv preview production
static-export preview production
web preview production

@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared c7f6853 against base 43560b1 using alternating same-runner rounds. Next.js was unchanged and skipped.

1 improved · 0 regressed · 5 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.3 KB 142.3 KB ⚫ +0.0%
Client entry size (gzip) vinext 129.7 KB 129.7 KB ⚫ -0.0%
Dev server cold start vinext 3.40 s 3.38 s ⚫ -0.7%
Production build time vinext 3.92 s 3.86 s 🟢 -1.7%
RSC entry closure size (gzip) vinext 127.9 KB 127.9 KB ⚫ +0.0%
Server bundle size (gzip) vinext 226.0 KB 226.0 KB ⚫ +0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Time limit: 8 minutes. Complete the review and post all findings within that limit.

@ask-bonk

ask-bonk Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@james-elicx
james-elicx marked this pull request as ready for review September 22, 2026 15:42
@james-elicx
james-elicx merged commit 009af46 into main Sep 22, 2026
85 of 86 checks passed
@james-elicx
james-elicx deleted the codex/response-store-lazy-invocation branch September 22, 2026 15:43
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.

1 participant