-
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
Image: Reduce 'block-editor' store subscriptions #57358
Conversation
Size Change: +6 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
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 change looks fine, but is there a way to see how much performance has improved?
I checked the logs using this debug code(c029303), but I don't know what number to use to compare it to trunk...
For example, below is the log output immediately after reloading the browser for a post with 256 image blocks.
sub block-editor 1000
index.js:107 sub block-editor 2000
index.js:114 ran waiting list: speed 58344 i/s avg 58344 i/s its 846 srem 14.5 frem 0 queued 1714
index.js:114 ran waiting list: speed 66296 i/s avg 62320 i/s its 537 srem 8.1 frem 0 queued 1177
index.js:114 ran waiting list: speed 70869 i/s avg 65170 i/s its 1141 srem 16.1 frem 0 queued 36
index.js:114 ran waiting list: speed 21176 i/s avg 54171 i/s its 36 srem 16 frem 14.3 queued 0
@t-hamano, this is a micro-optimization; I don't expect it to have a big impact on its own. But similar optimizations add up in the end. Here's a similar PR for Gallery block #57240. P.S. Code from c029303 only logs after 1000 subscriptions. You won't see a difference for small improvements like this. |
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.
@t-hamano, this is a micro-optimization; I don't expect it to have a big impact on its own. But similar optimizations add up in the end. Here's a similar PR for Gallery block #57240.
P.S. Code from c029303 only logs after 1000 subscriptions. You won't see a difference for small improvements like this.
I see, thank you for teaching me 👍
What?
PR combines two
block-editor
store subscriptions into one.Why?
Reduces the number of store subscriptions each time the Image block is rendered. See #54819 (comment).
How?
I just moved
multiImageSelection
into the existinguseSelect
for the block editor store. It doesn't depend on theimage
value, so there is no need to group them together.Testing Instructions
Testing Instructions for Keyboard
Same