Skip to content

wp-build: Add WP_BUILD_CONCURRENCY to change build concurrency - #86221

Draft
ellatrix wants to merge 2 commits into
trunkfrom
claude/confident-archimedes-jig0tr
Draft

ellatrix wants to merge 2 commits into
trunkfrom
claude/confident-archimedes-jig0tr

Conversation

@ellatrix

@ellatrix ellatrix commented Nov 3, 2026

Copy link
Copy Markdown
Member

What?

Follow up to #79889.

Adds a WP_BUILD_CONCURRENCY environment variable to wp-build to set how many builds run at once, and sets it to 4 in the CI steps that run the build.

Why?

wp-build runs half as many builds at once as there are cores. On a 4-core machine, such as a GitHub-hosted runner or a cloud dev container, that is only 2, and the CPU sits half idle.

wp-build bundling step on a 4-core, 15 GB container, 3 runs each:

Builds at once Run 1 Run 2 Run 3 Average
2 (current default) 137s 144s 135s 139s
4 93s 95s 94s 94s

The default stays at half the cores, so large projects keep the memory protection from #79889.

How?

  • getBuildConcurrency() returns WP_BUILD_CONCURRENCY when set, and the current default otherwise. A value that is not a whole number of 1 or more stops the build with an error.
  • CI build steps set WP_BUILD_CONCURRENCY: 4, matching the 4 cores of GitHub's standard Linux runners.

Testing Instructions

No Playground link: this changes the build tool, not the editor.

  1. npm run build and check the log says Using build concurrency: <half your cores>.
  2. WP_BUILD_CONCURRENCY=4 npm run build and check it says Using build concurrency: 4, and that it finishes faster on a machine with 4 or fewer cores.
  3. WP_BUILD_CONCURRENCY=abc npm run build and check it stops with WP_BUILD_CONCURRENCY must be a whole number of 1 or more, not "abc".
  4. npm run test:unit -- packages/wp-build/lib/test/build-concurrency.js. The new tests fail on trunk and pass here.
  5. Compare the "Npm build" step time in this PR's CI runs with trunk.

Testing Instructions for Keyboard

Not applicable, no UI change.

Screenshots or screencast

Not applicable, no UI change. Build times are in the table above.

Use of AI Tools

Written with Claude Code, reviewed by the author.


Generated by Claude Code

wp-build runs half as many builds at once as there are cores. On a
4-core machine, such as a GitHub-hosted runner, that is only 2.
Let WP_BUILD_CONCURRENCY override it, and set it to 4 in CI build steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ccWsAUiodTmx9cbyUUURG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ccWsAUiodTmx9cbyUUURG
@github-actions github-actions Bot added the [Package] wp-build /packages/wp-build label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

📦 Bundle size

Size Change: 0 B

Total Size: 8.58 MB

1b9a345 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 1e1418f trunk % Change
timeToFirstByte 54.85 ms +7.47% -1.64% 57.8 ms +15.05% -5.1% -5.1%
largestContentfulPaint 90 ms +8.89% -2.22% 94 ms +6.38% -4.26% -4.26%
lcpMinusTtfb 33.95 ms +15.91% -2.5% 34.35 ms +5.68% -2.91% -1.16%
wpBeforeTemplate 28.64 ms +3.35% -1.5% 30.82 ms +14.47% -5.68% -7.07%
wpTemplate 21.92 ms +4.56% -3.15% 22.57 ms +4.96% -3.81% -2.88%
wpTotal 50.88 ms +8.24% -1.85% 54.01 ms +13.03% -5.41% -5.8%
wpMemoryUsage 7.71 MB +0% -0% 7.67 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 1e1418f trunk % Change
timeToFirstByte 42.75 ms +5.5% -2.69% 48.35 ms +8.79% -4.76% -11.58%
largestContentfulPaint 92 ms +0% -4.35% 102 ms +3.92% -1.96% -9.8%
lcpMinusTtfb 47.4 ms +5.7% -1.9% 54.05 ms +1.57% -1.2% -12.3%
wpBeforeTemplate 26.7 ms +6.67% -2.25% 27.3 ms +7.14% -2.38% -2.2%
wpTemplate 12.76 ms +4.86% -5.02% 17.45 ms +4.93% -5.96% -26.88%
wpTotal 39.93 ms +5.16% -3.23% 45.09 ms +9.4% -4.57% -11.44%
wpMemoryUsage 6.28 MB +0% -0% 6.36 MB +0% -0% -1.22%
wpDbQueries 9 +0% -0% 13 +0% -0% -30.77%

media-processing

Metric 1e1418f trunk % Change
mediaProcessingJpeg 400.7 ms +1.48% -1.51% 407.14 ms +0.46% -1.37% -1.58%
mediaProcessingAvif 6152.42 ms +0.66% -0.09% 6265.96 ms +0.2% -0.14% -1.81%
mediaProcessingJpegToAvif 4253.96 ms +0.28% -0.47% 4366.21 ms +0.14% -0.16% -2.57%

media-upload

Metric 1e1418f trunk % Change
jpegUploadProcessing 1706.22 ms +15.16% -14.78% 1460.94 ms +1.63% -1.16% 16.79%
pngUploadProcessing 171.02 ms +9.3% -3.8% 173.73 ms +49.1% -3.22% -1.56%
largeJpegUploadProcessing 1453.11 ms +0.58% -0.45% 1456.26 ms +33.12% -0.65% -0.22%
multipleImageUploadProcessing 2023.36 ms +0.72% -0.36% 2044.66 ms +0.65% -1.54% -1.04%

post-editor

Metric 1e1418f trunk % Change
serverResponse 269.24 ms +4.57% -9.59% 242.98 ms +5.55% -6.75% 10.81%
firstPaint 247.43 ms +37.52% -32.46% 241.28 ms +28.82% -7.56% 2.55%
domContentLoaded 565.88 ms +4.43% -1.05% 534.19 ms +1.55% -1.46% 5.93%
loaded 566.57 ms +4.43% -1.05% 534.96 ms +1.58% -1.42% 5.91%
firstContentfulPaint 339.55 ms +1.49% -1.74% 315.29 ms +2.16% -1.42% 7.69%
firstBlock 1441.13 ms +7.63% -1.18% 1343.48 ms +1.45% -1.51% 7.27%
type 14 ms +3.14% -4.86% 11.74 ms +6.39% -5.62% 19.25%
typeWithoutInspector 12.66 ms +1.9% -7.35% 12.19 ms +1.89% -5.41% 3.86%
typeWithTopToolbar 15.48 ms +4.26% -4.01% 15.65 ms +3% -8.88% -1.09%
typeContainer 6.01 ms +8.49% -9.82% 5.14 ms +12.84% -5.84% 16.93%
focus 71.17 ms +3.77% -6.17% 70.18 ms +3.51% -2.18% 1.41%
firstFocus 143.84 ms +0% -0% 141.56 ms +0% -0% 1.61%
selectAll 249.81 ms +0.76% -1.28% 229.76 ms +0.83% -1.91% 8.73%
undo 20.14 ms +4.22% -5.21% 18.42 ms +6.19% -3.42% 9.34%
listViewOpen 45.46 ms +7.61% -7.9% 42.89 ms +5.43% -9.35% 5.99%
inserterOpen 29.79 ms +8.22% -6.78% 25.62 ms +6.99% -3.67% 16.28%
inserterHover 9.57 ms +4.28% -10.03% 7.66 ms +9.27% -4.18% 24.93%
inserterSearch 6.99 ms +5.87% -3.86% 6.22 ms +4.98% -4.02% 12.38%
loadPatterns 447.19 ms +9.91% -3.5% 416.31 ms +7.54% -2.45% 7.42%
wpTotal 262.19 ms +4.65% -9.82% 236.29 ms +5.7% -6.94% 10.96%
wpMemoryUsage 14.75 MB +0% -0% 14.72 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 1e1418f trunk % Change
serverResponse 471.28 ms +4.11% -8.13% 486.76 ms +2.1% -9.01% -3.18%
firstPaint 360.42 ms +6.86% -9.42% 344.16 ms +10.91% -10.87% 4.72%
domContentLoaded 894.83 ms +2.01% -2.12% 886.2 ms +1.21% -0.96% 0.97%
loaded 895.96 ms +2.01% -2.14% 887.2 ms +1.19% -0.94% 0.99%
firstContentfulPaint 516.27 ms +7.17% -2.89% 508.18 ms +1.23% -1.21% 1.59%
firstBlock 2609.4 ms +2.97% -0.53% 2592.38 ms +1.66% -0.83% 0.66%
type 17.81 ms +9.6% -4.66% 19.24 ms +10.5% -5.41% -7.43%
navigate 117.83 ms +7.64% -1.82% 114.98 ms +17.35% -1.61% 2.48%
loadPatterns 1284.26 ms +10.85% -7.03% 1263.12 ms +6.94% -15.62% 1.67%
loadPages 1022.86 ms +2.84% -5.76% 1030.91 ms +3.03% -3.39% -0.78%
wpTotal 461.91 ms +4.19% -8.31% 477.2 ms +2.17% -9.21% -3.2%
wpMemoryUsage 12.77 MB +0% -0% 12.73 MB +0% -0% 0.27%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

1b9a345 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Actions are reachable via RIGHT/LEFT arrow keys (Site Editor v2) in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByRole('row', { name: 'Page One View Actions' }).getByRole('button', { name: 'View' })
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByRole('row', { name: 'Page One View Actions' }).getByRole('button', { name: 'View' }) with timeout 5000ms
  - waiting for getByRole('row', { name: 'Page One View Actions' }).getByRole('button', { name: 'View' })
    14 × locator resolved to <button type="button" tabindex="-1" class="components-button is-small" id="view-list-0-12-primary-action-view-post">View</button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:190:5
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 2,
+   "offset": 2,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
inserts a block in proper place after having clicked `Browse All` from inline inserter in /test/e2e/specs/editor/various/inserting-blocks.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('button', { name: 'Add block' })
    - locator resolved to <button type="button" aria-pressed="false" aria-haspopup="true" aria-expanded="false" aria-label="Add block" class="components-button block-editor-inserter__toggle is-next-40px-default-size has-icon">…</button>
  - attempting click action
    - waiting for element to be visible, enabled and stable
  - element was detached from the DOM, retrying

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/inserting-blocks.spec.js:557:5
should keep correct selection when dragging outside block (-firefox) in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

  Array [
    Object {
      "attributes": Object {
-       "content": "1",
+       "content": "23",
      },
      "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:787:41
should undo without broken temporary state in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:image -->
- <figure class="wp-block-image"><img alt=""/></figure>
+ <!-- wp:image {"id":24,"sizeSlug":"full","linkDestination":"none"} -->
+ <figure class="wp-block-image size-full"><img src="http://localhost:8891/wp-content/uploads/2026/11/fe47ccb9-461d-4be7-b97b-6f5d8572f75b.png" alt="" class="wp-image-24"/></figure>
  <!-- /wp:image -->
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:432:49

1b9a345 Run

This branch has not been deployed

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

Labels

[Package] wp-build /packages/wp-build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants