-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Improve performance of compute_style_properties
method.
#62522
Conversation
Improve logic in compute_style_properties to improve performance. This commit fixes a number of performance issues including. - Expensive repeated call to `str_starts_with`. - Return easy if not array. - Repeated call to `strlen`. - Move call to `get_property_value` where it is needed. - Move call to implode to after empty check.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @jonnynews. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good refactor to me. Left a couple of comments inline.
Co-authored-by: Joe McGill <801097+joemcgill@users.noreply.github.com>
Flaky tests detected in eca89a5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9512834878
|
The |
That is not how that works. All PRs that need to be manaully ported over, have that label assigned and are added the backport issue. Has this been changed? Where is that documented? |
Sure, it's fine to leave the label. Most important is that there's a core PR. |
Core PR WordPress/wordpress-develop#6707. Will update and commit once this PR is merged. |
* Improve performance of `compute_style_properties` method. Improve logic in compute_style_properties to improve performance. This commit fixes a number of performance issues including. - Expensive repeated call to `str_starts_with`. - Return easy if not array. - Repeated call to `strlen`. - Move call to `get_property_value` where it is needed. - Move call to implode to after empty check. * Fix lint. * Apply suggestions from code review Co-authored-by: Joe McGill <801097+joemcgill@users.noreply.github.com> --------- Co-authored-by: Jonny Harris <jonathan.harris@news.co.uk> Co-authored-by: Joe McGill <801097+joemcgill@users.noreply.github.com>
I just cherry-picked this PR to the wp/6.6-rc-1 branch to get it included in the next release: 1116c38 |
* Improve performance of `compute_style_properties` method. Improve logic in compute_style_properties to improve performance. This commit fixes a number of performance issues including. - Expensive repeated call to `str_starts_with`. - Return easy if not array. - Repeated call to `strlen`. - Move call to `get_property_value` where it is needed. - Move call to implode to after empty check. * Fix lint. * Apply suggestions from code review Co-authored-by: Joe McGill <801097+joemcgill@users.noreply.github.com> --------- Co-authored-by: Jonny Harris <jonathan.harris@news.co.uk> Co-authored-by: Joe McGill <801097+joemcgill@users.noreply.github.com>
Why did you merge this with failing tests? A backport changelog entry should have been added for this PR |
Improve logic in compute_style_properties to improve performance. This commit fixes a number of performance issues including.
str_starts_with
.strlen
.get_property_value
where it is needed.What?
Why?
Before
After
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast