Repository navigation
Patterns: Speed up the Patterns screen on sites with many patterns - #85234
Draft
MaggieCabrera wants to merge 2 commits into
Draft
MaggieCabrera wants to merge 2 commits into
MaggieCabrera wants to merge 2 commits into
Conversation
The Patterns screen parsed the blocks of every theme, plugin and core pattern up front, and removed duplicate names with a findIndex inside a filter. With thousands of patterns both are slow. Blocks are now parsed when a preview first reads them and cached per pattern, and duplicates are removed in one pass. The extensible site editor gets the same dedupe; it already parses in the preview. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖📦 Bundle sizeSize Change: +67 B (0%) Total Size: 9.05 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome 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. Regression: updating a specific option will only change its value and will not corrupt others in
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Follow-up to the performance review of #84507. The site editor's Patterns screen no longer freezes on sites with lots of patterns. With 2,000 extra patterns registered, the first previews show in about 1 s instead of 3.4 s.
Medians of 7 runs with Playwright, CDP
Performance.getMetricsand a long task observer, on Twenty Twenty-Five plus a test plugin that registers 2,000 copies of its patterns. With 4× CPU throttling, the longest task goes from 10.6 s to 0.8 s.Why?
The Patterns screen parsed every theme, plugin and core pattern as soon as it loaded, even though it only shows 20 per page. It also removed duplicate names with a
findIndexinside afilter, which slows down quickly as the list grows. Sites with lots of plugin or theme patterns already hit this today, and #84507 would add many more.How?
blocksare parsed the first time its preview reads them, and cached per pattern. It's the approach the block editor store has used since Reusable blocks: fix performance of __experimentalGetAllowedPatterns #64871.tsconfig.test.json, likepackages/grid, so the new tests can be TypeScript.Testing Instructions
Testing Instructions for Keyboard
No UI changes.
Use of AI Tools
Written with Claude Code (Claude Opus 5.5), including the test plugin and the measuring script. I reviewed the changes and checked the numbers.
🤖 Generated with Claude Code