Skip to content

perf(build): parallelize Sharp runtime packaging - #220

Open
Kinfe123 wants to merge 1 commit into
mainfrom
perf/parallel-sharp-packaging
Open

perf(build): parallelize Sharp runtime packaging#220
Kinfe123 wants to merge 1 commit into
mainfrom
perf/parallel-sharp-packaging

Conversation

@Kinfe123

Copy link
Copy Markdown
Member

What changed

  • stage the Sharp production runtime while Nitro builds the server bundle
  • merge the staged packages into the final output after Nitro completes
  • preserve dependency metadata and clean temporary staging directories on success or failure
  • handle existing directories and cross-device filesystem moves safely

Why

Sharp runtime packaging was a serial post-build step. Copying it concurrently with Nitro removes that work from the critical path without changing the generated runtime contract.

In an interleaved local A/B measurement, this packaging section improved from a 583 ms median to 545 ms, about 6.5% faster.

Impact

This affects production build packaging only. The development server and application runtime behavior are unchanged. Node and Vercel outputs still include the same Sharp runtime packages.

Validation

  • pnpm --filter @farmjs/core build
  • packages/farm/src/__tests__/production-prebuilt-ssr.test.ts — 16/16 passed
  • basic example local dev: routes, API, client navigation, and hydration verified
  • basic example production build and server: HTML, API, CSS, JavaScript, navigation, and browser back verified
  • Sharp import and real image transformation verified in production output
  • Vercel output verified to contain Sharp and its dependency metadata
  • compared serial and parallel outputs: identical file/content set apart from generated timestamps
  • zero browser console or page errors in local and production checks

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jul 25, 2026 7:22pm
farm.js Ready Ready Preview, Comment Jul 25, 2026 7:22pm

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