Skip to content

perf(next-plugin): profile and reuse Turbopack prewarm output - #645

Open
owjs3901 wants to merge 20 commits into
mainfrom
owjs3901/turbo-profile
Open

perf(next-plugin): profile and reuse Turbopack prewarm output#645
owjs3901 wants to merge 20 commits into
mainfrom
owjs3901/turbo-profile

Conversation

@owjs3901

@owjs3901 owjs3901 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add opt-in structured Turbopack timings for graph setup, production prewarm, coordinator extraction, snapshots, serialization, and writes
  • reuse byte-identical singleCss prewarm output so Turbopack loaders do not repeat WASM extraction
  • keep polymorphic React inference exact while preventing redundant native-prop inference and duplicate intrinsic-prop conditionals
  • stabilize the existing benchmark.js comparison in the existing Publish workflow: remove Next memory-debug overhead, clean every sample, alternate order, and report six-sample medians

Validation

  • wasm-pack release build completed after Smart App Control was disabled; no security-policy bypass was used
  • Next plugin tests: 111 passed, 0 failed with the real WASM package
  • React tests: 37 passed, 0 failed; React lint/build and TypeScript 6/7 type tests passed
  • compile-time checks cover anchor/button event inference, invalid native props, required custom-component props, and bidirectional compatibility with the previous intrinsic/custom prop types
  • clean CI run (benchmark, publish, landing-next-e2e all passed): https://github.com/dev-five-git/devup-ui/actions/runs/33193236872
  • Codecov report: 100.0% overall, including 407/407 covered lines in coordinator.ts

Existing benchmark.js CI result

Six alternating cold builds on the same Ubuntu runner, using normal next build:

Phase Devup UI singleCss Tailwind Turbo Result
Turbopack compile 4.0 s 4.1 s Devup UI 0.1 s faster
Next config 104 ms 13 ms Devup UI 91 ms slower
TypeScript 351 ms 257 ms Devup UI 94 ms slower
Full wall time 6.82 s 6.76 s Devup UI 60 ms / 0.9% slower
Emitted CSS 327 bytes 6,197 bytes Devup UI 94.7% smaller

Raw wall samples:

  • Tailwind Turbo: 6.79, 6.76, 6.71, 6.77, 6.68, 6.77 s
  • Devup UI singleCss: 6.81, 6.87, 6.77, 6.76, 6.90, 6.83 s

The type changes reduced the Devup fixture's CI type check from roughly 840 ms to 351 ms without weakening inference. A Rust/WASM -O3 experiment was rejected: it produced a 7.61 s Devup median versus 6.95 s Tailwind and increased package-build time and WASM size. The compact s/-Oz settings remain.

Structured timings put CSS/sheet/class/file serialization below 1 ms, so batching/debouncing it would add complexity without addressing the measured bottleneck.

Benchmark limits

This is substantially fairer than the previous one-shot fixed-order benchmark, but it is still not proof that one library is generally faster. The fixtures are not semantically identical: Tailwind uses untyped class strings and emits its framework CSS, while Devup validates rich responsive/polymorphic props and emits much less CSS. The latest full-build median is still 60 ms slower; the two preceding clean runs were also 160 ms and 110 ms slower. This PR therefore does not claim that Devup currently beats Tailwind end-to-end. Disabling type checking or weakening inference would reverse the goal and was deliberately not done.

The local full pre-commit suite still has an unrelated Bun transform-cache issue that resolves df/devup-ui.css from another worktree (5055 pass, 7 fail); it does not reproduce on clean CI. bun.lock and the add-bench PR are excluded from this PR's changes.

@github-actions

Copy link
Copy Markdown
Contributor

Changepacks

@devup-ui/next-plugin@1.0.83 - packages/next-plugin/package.json

Maybe you forgot to write the following files to the latest version

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
bindings/devup-ui-wasm/src/lib.rs 100.00% <100.00%> (ø)
libs/extractor/src/lib.rs 100.00% <100.00%> (ø)
packages/next-plugin/src/coordinator.ts 100.00% <100.00%> (ø)
packages/next-plugin/src/plugin.ts 100.00% <100.00%> (ø)
packages/next-plugin/src/profile.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@owjs3901
owjs3901 force-pushed the owjs3901/turbo-profile branch from c417e05 to 679c2ec Compare August 28, 2026 16:05
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