-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Perf: Try pure function version of useBlockDisplayInformation and useBlockDisplayTitle #73095
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
base: trunk
Are you sure you want to change the base?
Conversation
…isplayTitle Seeing if using a pure function version of these in components that already have a useSelect will help improve performance. The list view is especially heavy on this, so combining selectors there can have a compounding effect.
|
Size Change: +443 B (+0.02%) Total Size: 2.47 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 694159e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19174648627
|
|
What do you think about introducing new private selectors for block icon and title. I had a proposal while ago, but closed it since didn't had time to work on it and wasn't expected significant perf improvements - #73095. |
|
I'm not opposed. I think there should be some refactoring done, as there are scattered usages of useBlockDisplayInfo that only use the icon and title. And even some that do useBlockDisplayInfo to get the icon and useBlockDisplayTitle to get the title. I don't expect much perf improvement either, but the code for titles is especially confusing, and I feel like it shouldn't be :) |
What?
Seeing if using a pure function version of these in components that already have a useSelect will help improve performance. The list view is especially heavy on this, so combining selectors there can have a compounding effect.
Also, adds a new performance test for typing with the list view open on a page with many blocks. This should stress test the system more. I'd like it to be obvious when there's a new useSelect added that is not performant.
Why?
Perf.
How?
Extract the guts of the hooks and export those as a function as well. That way, if you have an existing useSelect, you don't have to add a new one in order to use the function.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast