WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.5k stars 4.19k forks source link

Grid: Improve performance #63976

Open noisysocks opened 3 months ago

noisysocks commented 3 months ago

The performance of the Grid block when in Manual mode (and probably also Auto mode) is bad.

You particularly notice that the UI is slow to react to mouse events after the editor has been running for a while, so there's probably some memory leaking.

I can also see that all the components in GridVisualizer are updating on every keystroke which isn't good. An easy win might be to memo() every cell. We are probably over-useSelecting data in a lot of places too.

https://github.com/user-attachments/assets/9168f66d-ee7b-441f-ae13-252d2aaab227

Let's spend some time tuning this before shipping.

noisysocks commented 3 months ago

Sharing a that @richtabor made which shows some serious performance degradation:

https://github.com/user-attachments/assets/fd0a4eff-1a68-4024-969e-6fa07b2512ec