Skip to content

perf: skip hashing temporary prerender chunks - #31

Closed
ttmx wants to merge 1 commit into
cloudflare:mainfrom
ttmx:perf/hashless-prerender-bundles
Closed

perf: skip hashing temporary prerender chunks#31
ttmx wants to merge 1 commit into
cloudflare:mainfrom
ttmx:perf/hashless-prerender-bundles

Conversation

@ttmx

@ttmx ttmx commented Jul 22, 2026

Copy link
Copy Markdown

Summary

  • use deterministic, hashless filenames for JavaScript emitted by Astro's temporary prerender environment
  • preserve hashes for assets that are copied into the final site
  • preserve consumer-supplied Rollup output naming and leave array-form output configurations untouched

Why

Astro imports the prerender bundle to generate static pages and deletes it afterward. On large sites, Rollup's final hash generation repeatedly walks the transitive graph for thousands of temporary lazy chunks. This Rollup hashing was built for actually shipped bundles, for cache and cache busting purposes, but instead it is used on an intermediate local only build.

On the current Cloudflare Docs build (8,708 pages), an isolated cold-build A/B measured:

Variant Wall time Prerender Vite bundle
Normal hashed chunks 7:43.99 3m 51s
Hashless temporary chunks 5:23.51 1m 39s

That is 2m 20.48s less wall time (30.3%) and 2m 12s less prerender bundling time (57%). Both builds used identical source and had dist, .astro, and .astro-cache removed beforehand.

Safety

  • the override is scoped to Vite's prerender environment, not client or deployed server output
  • assetFileNames is not changed
  • Rollup resolves duplicate chunk names with unique suffixes and rewrites internal imports accordingly
  • explicit top-level or prerender-specific entryFileNames/chunkFileNames settings win

Validation

  • pnpm --filter nimbus-docs typecheck
  • pnpm --filter nimbus-docs test (426 tests passed)
  • full Cloudflare Docs cold builds completed with the same 8,708-page count and contents are the same (Except for randomly generated IDs)

@github-actions

Copy link
Copy Markdown
Contributor

Nimbus doesn't take unsolicited pull requests. See CONTRIBUTING.md.

File it instead as:

Once a maintainer takes your issue or discussion forward they'll approve you there, and your PRs stay open from then on. Closing this one.

@github-actions github-actions Bot closed this Jul 22, 2026
@MohamedH1998 MohamedH1998 reopened this Jul 22, 2026
@ttmx

ttmx commented Jul 24, 2026

Copy link
Copy Markdown
Author

/bonk

@MohamedH1998

Copy link
Copy Markdown
Collaborator

closing I've hardened the changes with this PR

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.

2 participants