Skip to content

[docs-infra] Support turbopack for docs#48569

Open
brijeshb42 wants to merge 6 commits into
mui:masterfrom
brijeshb42:turbopack
Open

[docs-infra] Support turbopack for docs#48569
brijeshb42 wants to merge 6 commits into
mui:masterfrom
brijeshb42:turbopack

Conversation

@brijeshb42
Copy link
Copy Markdown
Contributor

A followup to #48370
Only the latest commit is of this PR. Others are from the above PR.

Bundler benchmark: webpack vs turbopack

  • Host: Brijeshs-MacBook-Pro.local (darwin arm64, 14 cores, 38.7 GB RAM)
  • Node: v24.14.0
  • Next.js: 16.2.6
  • Date: 2026-05-25
  • Runs per metric: 10 (HMR: + 2 warmup discarded)
  • Component page: /material-ui/react-button/
  • HMR edit target: docs/data/material/components/buttons/BasicButtons.js. First >WORD< JSX text child rewritten to a fresh marker each run (cascade, no reset between runs).
  • HMR timing: writeFile → first [Fast Refresh] done in Xms console event seen in a headless Chrome tab (Playwright).

Summary

Metric webpack (mean) turbopack (mean) turbopack vs webpack
Cold prod build 98.43 s 36.03 s 2.73× faster
Dev startup (process boot → Ready in) 408 ms 368 ms 1.11× faster
Home / cold first-load 5.68 s 4.77 s 1.19× faster
Component cold first-load 2.06 s 1.32 s 1.56× faster
HMR — driver wall clock (edit → event) 416 ms 282 ms 1.47× faster
HMR — bundler-reported (Fast Refresh done in Xms) 402 ms 111 ms 3.64× faster

Cold prod build (next build)

bundler n mean stddev min median p95 max
webpack 10 98.43 s 4.06 s 93.40 s 97.25 s 108.51 s 108.51 s
turbopack 10 36.03 s 2.51 s 32.16 s 36.34 s 39.20 s 39.20 s

turbopack mean 2.73× faster than webpack.

raw samples (ms)
  • webpack: 97644, 96750, 93396, 101528, 108506, 97228, 96482, 97265, 97160, 98348
  • turbopack: 32157, 32827, 33746, 35170, 35528, 37154, 37905, 38132, 38482, 39204

Dev startup (process boot → Ready in)

bundler n mean stddev min median p95 max
webpack 10 408 ms 90 ms 350 ms 372 ms 642 ms 642 ms
turbopack 10 368 ms 15 ms 354 ms 367 ms 403 ms 403 ms

turbopack mean 1.11× faster than webpack.

raw samples (ms)
  • webpack: 642, 382, 464, 434, 356, 383, 359, 350, 362, 352
  • turbopack: 362, 403, 371, 358, 356, 382, 356, 371, 354, 371

Home / cold first-load

bundler n mean stddev min median p95 max
webpack 10 5.68 s 1.69 s 4.74 s 5.11 s 10.41 s 10.41 s
turbopack 10 4.77 s 151 ms 4.54 s 4.74 s 5.05 s 5.05 s

turbopack mean 1.19× faster than webpack.

raw samples (ms)
  • webpack: 10412, 5940, 5449, 4992, 5071, 4966, 5139, 4927, 4737, 5198
  • turbopack: 4728, 4873, 5054, 4847, 4695, 4542, 4882, 4753, 4594, 4704

Component /material-ui/react-button/ cold first-load

bundler n mean stddev min median p95 max
webpack 10 2.06 s 742 ms 1.68 s 1.74 s 3.85 s 3.85 s
turbopack 10 1.32 s 41 ms 1.27 s 1.32 s 1.39 s 1.39 s

turbopack mean 1.56× faster than webpack.

raw samples (ms)
  • webpack: 3849, 2973, 1775, 1749, 1680, 1685, 1726, 1710, 1690, 1764
  • turbopack: 1277, 1385, 1315, 1326, 1289, 1266, 1350, 1349, 1375, 1295

HMR — edit → [Fast Refresh] done (driver wall clock)

Real HMR via Playwright: edit demo file, observe the next [Fast Refresh] done console event in the open browser tab.

bundler n mean stddev min median p95 max
webpack 10 416 ms 48 ms 341 ms 421 ms 482 ms 482 ms
turbopack 10 282 ms 57 ms 212 ms 290 ms 358 ms 358 ms

turbopack mean 1.47× faster than webpack.

raw samples (ms)
  • webpack: 453, 396, 448, 382, 446, 366, 482, 381, 463, 341
  • turbopack: 358, 212, 319, 215, 328, 230, 336, 236, 329, 260

HMR — bundler-reported ([Fast Refresh] done in Xms)

Parses the Xms value printed by Next's Fast Refresh runtime — bundler-side recompile only, excludes WS round-trip and Playwright console plumbing.

bundler n mean stddev min median p95 max
webpack 10 402 ms 48 ms 327 ms 408 ms 469 ms 469 ms
turbopack 10 111 ms 75 ms 71 ms 87 ms 320 ms 320 ms

turbopack mean 3.64× faster than webpack.

raw samples (ms)
  • webpack: 440, 382, 435, 369, 433, 353, 469, 366, 449, 327
  • turbopack: 99, 74, 71, 77, 82, 91, 320, 99, 71, 121

brijeshb42 and others added 4 commits May 25, 2026 16:46
…ranslation

Collapse the helper to operate on a single raw translation object. The
caller no longer wraps in a require.context shim or a per-language map;
it just passes the imported English JSON. The function mutates and
returns the translation with `componentDescription` rendered to HTML
and `componentDescriptionToc` populated.

Breaking change for downstream consumers (mui-x). Coordinate the
@mui/internal-core-docs publish with PR 3+4 once mui-x has migrated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Update the ComponentApiBuilder template to statically import the
English translation JSON and call mapApiPageTranslation directly. The
{ en: ... } wrapper is constructed at the call site since ApiPage still
indexes descriptions by language. Webpack's require.context is gone and
the runtime markdown renderer stays out of the API page client bundle
because Next strips the import along with getStaticProps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Bundler benchmark: webpack vs turbopack

- Host: Brijeshs-MacBook-Pro.local (darwin arm64, 14 cores, 38.7 GB RAM)
- Node: v24.14.0
- Next.js: 16.2.6
- Date: 2026-05-25
- Runs per metric: 10 (HMR: + 2 warmup discarded)
- Component page: `/material-ui/react-button/`
- HMR edit target: `docs/data/material/components/buttons/BasicButtons.js`. First `>WORD<` JSX text child rewritten to a fresh marker each run (cascade, no reset between runs).
- HMR timing: `writeFile` → first `[Fast Refresh] done in Xms` console event seen in a headless Chrome tab (Playwright).

## Summary

| Metric | webpack (mean) | turbopack (mean) | turbopack vs webpack |
|---|---:|---:|---:|
| Cold prod build | 98.43 s | 36.03 s | **2.73× faster** |
| Dev startup (process boot → `Ready in`) | 408 ms | 368 ms | 1.11× faster |
| Home `/` cold first-load | 5.68 s | 4.77 s | 1.19× faster |
| Component cold first-load | 2.06 s | 1.32 s | **1.56× faster** |
| HMR — driver wall clock (edit → event) | 416 ms | 282 ms | **1.47× faster** |
| HMR — bundler-reported (`Fast Refresh done in Xms`) | 402 ms | 111 ms | **3.64× faster** |

### Cold prod build (`next build`)

| bundler | n | mean | stddev | min | median | p95 | max |
|---|---:|---:|---:|---:|---:|---:|---:|
| webpack | 10 | 98.43 s | 4.06 s | 93.40 s | 97.25 s | 108.51 s | 108.51 s |
| turbopack | 10 | 36.03 s | 2.51 s | 32.16 s | 36.34 s | 39.20 s | 39.20 s |

_turbopack mean **2.73× faster** than webpack._

<details><summary>raw samples (ms)</summary>

- **webpack**: `97644, 96750, 93396, 101528, 108506, 97228, 96482, 97265, 97160, 98348`
- **turbopack**: `32157, 32827, 33746, 35170, 35528, 37154, 37905, 38132, 38482, 39204`

</details>

### Dev startup (process boot → `Ready in`)

| bundler | n | mean | stddev | min | median | p95 | max |
|---|---:|---:|---:|---:|---:|---:|---:|
| webpack | 10 | 408 ms | 90 ms | 350 ms | 372 ms | 642 ms | 642 ms |
| turbopack | 10 | 368 ms | 15 ms | 354 ms | 367 ms | 403 ms | 403 ms |

_turbopack mean **1.11× faster** than webpack._

<details><summary>raw samples (ms)</summary>

- **webpack**: `642, 382, 464, 434, 356, 383, 359, 350, 362, 352`
- **turbopack**: `362, 403, 371, 358, 356, 382, 356, 371, 354, 371`

</details>

### Home `/` cold first-load

| bundler | n | mean | stddev | min | median | p95 | max |
|---|---:|---:|---:|---:|---:|---:|---:|
| webpack | 10 | 5.68 s | 1.69 s | 4.74 s | 5.11 s | 10.41 s | 10.41 s |
| turbopack | 10 | 4.77 s | 151 ms | 4.54 s | 4.74 s | 5.05 s | 5.05 s |

_turbopack mean **1.19× faster** than webpack._

<details><summary>raw samples (ms)</summary>

- **webpack**: `10412, 5940, 5449, 4992, 5071, 4966, 5139, 4927, 4737, 5198`
- **turbopack**: `4728, 4873, 5054, 4847, 4695, 4542, 4882, 4753, 4594, 4704`

</details>

### Component `/material-ui/react-button/` cold first-load

| bundler | n | mean | stddev | min | median | p95 | max |
|---|---:|---:|---:|---:|---:|---:|---:|
| webpack | 10 | 2.06 s | 742 ms | 1.68 s | 1.74 s | 3.85 s | 3.85 s |
| turbopack | 10 | 1.32 s | 41 ms | 1.27 s | 1.32 s | 1.39 s | 1.39 s |

_turbopack mean **1.56× faster** than webpack._

<details><summary>raw samples (ms)</summary>

- **webpack**: `3849, 2973, 1775, 1749, 1680, 1685, 1726, 1710, 1690, 1764`
- **turbopack**: `1277, 1385, 1315, 1326, 1289, 1266, 1350, 1349, 1375, 1295`

</details>

### HMR — edit → `[Fast Refresh] done` (driver wall clock)

Real HMR via Playwright: edit demo file, observe the next `[Fast Refresh] done` console event in the open browser tab.

| bundler | n | mean | stddev | min | median | p95 | max |
|---|---:|---:|---:|---:|---:|---:|---:|
| webpack | 10 | 416 ms | 48 ms | 341 ms | 421 ms | 482 ms | 482 ms |
| turbopack | 10 | 282 ms | 57 ms | 212 ms | 290 ms | 358 ms | 358 ms |

_turbopack mean **1.47× faster** than webpack._

<details><summary>raw samples (ms)</summary>

- **webpack**: `453, 396, 448, 382, 446, 366, 482, 381, 463, 341`
- **turbopack**: `358, 212, 319, 215, 328, 230, 336, 236, 329, 260`

</details>

### HMR — bundler-reported (`[Fast Refresh] done in Xms`)

Parses the `Xms` value printed by Next's Fast Refresh runtime — bundler-side recompile only, excludes WS round-trip and Playwright console plumbing.

| bundler | n | mean | stddev | min | median | p95 | max |
|---|---:|---:|---:|---:|---:|---:|---:|
| webpack | 10 | 402 ms | 48 ms | 327 ms | 408 ms | 469 ms | 469 ms |
| turbopack | 10 | 111 ms | 75 ms | 71 ms | 87 ms | 320 ms | 320 ms |

_turbopack mean **3.64× faster** than webpack._

<details><summary>raw samples (ms)</summary>

- **webpack**: `440, 382, 435, 369, 433, 353, 469, 366, 449, 327`
- **turbopack**: `99, 74, 71, 77, 82, 91, 320, 99, 71, 121`

</details>
@brijeshb42 brijeshb42 added the scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). label May 25, 2026
@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 25, 2026

Deploy preview

https://deploy-preview-48569--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant