Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try: reduce number of WP_Theme_JSON instances #53357

Closed
wants to merge 2 commits into from

Conversation

oandregal
Copy link
Member

DRAFT PR TO SEE THE IMPACT ON PERFORMANCE TESTS. NOT TO MERGE.

Related #45171

What?

Reduce the number of WP_Theme_JSON instances.

Why?

Faster is better.

How?

This PR tries to avoid cache invalidation for some of the existing theme.json caches. By doing so, the number of instances of WP_Theme_JSON go from 30 to 18, reducing the number of processes and the time they take.

Testing Instructions

See the impact of the performance tests. TBD.

This simulates that blocks do not invalidate the cache. It is a hack
to get a prototype working and gauge the impact on performance. The
final code should delay sanitization to later stages.
@oandregal oandregal self-assigned this Aug 4, 2023
@oandregal oandregal changed the title Try/reduce number of theme json instances Try: reduce number of WP_Theme_JSON instances Aug 4, 2023
@oandregal oandregal added the [Type] Performance Related to performance efforts label Aug 4, 2023
@github-actions
Copy link

github-actions bot commented Aug 4, 2023

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/class-wp-theme-json-gutenberg.php
❔ lib/class-wp-theme-json-resolver-gutenberg.php

@oandregal
Copy link
Member Author

Something like this would be a little improvement for both classic and block themes (-2ms).

Captura de ecrã 2023-08-18, às 17 34 57

@oandregal oandregal closed this Apr 19, 2024
@oandregal oandregal deleted the try/reduce-number-of-theme-json-instances branch April 19, 2024 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant