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

Blocks: Remove inject_hooked_block_markup filter #5292

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Sep 25, 2023

Per discussion in #5271, there's agreement that the new hooked_block_types filter covers conditional addition and removal of hooked blocks better and at a higher level than the inject_hooked_block_markup filter that was originally added in #5261 for that same purpose, and that the latter should thus be removed.

Trac ticket: https://core.trac.wordpress.org/ticket/59439


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@ockham ockham self-assigned this Sep 25, 2023
@ockham ockham requested a review from gziolo September 25, 2023 09:01
@ockham ockham marked this pull request as ready for review September 25, 2023 09:01
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thank you for a quick follow-up.

Per discussion in #59424, there's agreement that the new `hooked_block_types` filter  (introduced in [56673]) covers conditional addition and removal of hooked blocks better and at a higher level than the `inject_hooked_block_markup` filter that was originally added in [56649] for that same purpose.
Consequently, this changeset removes the latter filter.

Props gziolo.
Fixes #59439.
@gziolo
Copy link
Member

gziolo commented Sep 25, 2023

@felixarntz, I'm wondering how much we can trust this performance job:

Screenshot 2023-09-25 at 11 05 50

We don't have any hooked blocks in WordPress core, so there should be no difference between this branch and trunk. There is going to be improvement when using plugins, but we can't measure that with this job.

@ockham ockham force-pushed the remove/inject-hooked-block-markup-filter branch from 9ffa37a to 9e53373 Compare September 25, 2023 09:11
@ockham
Copy link
Contributor Author

ockham commented Sep 25, 2023

Committed to Core in https://core.trac.wordpress.org/changeset/56674.

@ockham ockham closed this Sep 25, 2023
@ockham ockham deleted the remove/inject-hooked-block-markup-filter branch September 25, 2023 09:13
@felixarntz
Copy link
Member

@gziolo It looks strange that this appears to have such an impact in classic themes indeed (see https://github.com/WordPress/wordpress-develop/actions/runs/6297076920). Though if this function is called very often on page load, it could have an actual impact to just remove the filter appliance - though I can't imagine that is the case, as it would need to be extremely often 😆

We are aware of sometimes notable variance in the performance test results, but generally Server-Timing has been much more stable than the Web Vitals, so this difference is confusing to see.

@swissspidy Do you have any idea?

@swissspidy
Copy link
Member

I'm sure y'all have seen the Due to the nature of how GitHub Actions work, some variance in the results is expected. disclaimer at the top. The comparison table is a nice addition, but we still have a lot of work to do to reduce the variance in the current performance test setup, i.e. clearing caches, actually logging out the user, doing more iterations, etc.

In the meantime, best to compare the numbers with other runs on PR or trunk to get a better feeling for the variance.

@felixarntz
Copy link
Member

I just ran a benchmark for this locally using TT1, and it gave me:

  • 52.13ms without the PR
  • 53.4ms with the PR

That difference is small enough to be safely discarded as variance as there is also absolutely no way this could be slower as it's only removing a filter execution.

Still, seeing this kind of huge difference in the CI workflow makes me doubt its reliability at the moment. While a centrally visible and reusable workflow is certainly the goal, there may unfortunately still be value in running benchmarks individually on a personal machine as it seems the environment in GitHub Actions is far less controlled than a regular machine 😞

@swissspidy
Copy link
Member

It's known that GitHub Actions runners don't provide the most consistent environment. Results can change even depending on the time of day (and thus load). But that's all solvable to some degree :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants