-
-
Notifications
You must be signed in to change notification settings - Fork 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
diff/patch slower in 10.4.5 when removing >1 keyed items from the list #2619
Comments
hm the only change that seems relevant is this #2551 . The other PRs look harmless. Comparing the flamegraphs of 10.4.5 and 10.4.4 shows that |
Just want to clarify that performance impact is not that js execution is taking more time, but that it triggers DOM style/layout/repaint (for 1000s of elements in our case) where previously there was none. |
Good point! I wouldn't go so far as to say there being "none" before in 10.4.4 looking at the metrics on my end, but admittedly there is lot less time spent in rendering, painting and scripting with 10.4.4 compared to 10.4.5. |
Something that could help is improving the check here essentially this branch is very specific to this one issue. We should be able to define this behaviour better but this fix has just been added. |
Moved to #2622 |
@xkam nice repro! A separate issue would be fantastic for that. |
I can finally reproduce this issue in an isolated example -
Here is the output with 10.4.4 -
And this one is with 10.4.5 -
The only difference with #2622 is the presence of |
Hey, would you mind testing this with: https://pkg.csb.dev/preactjs/preact/commit/9ff1e5f6/preact I think this fixes the issue. |
No, the issue is still there, tested both with full datagrid and the isolated code above. With 9ff1e5f I still get
|
This is fixed in latest https://codesandbox.io/s/withered-snowflake-6lm3zs?file=/src/index.mjs |
Looks like the diff/patch sometimes does unnecessary re-ordering of the child nodes instead of just remove two or more consecutive items from the middle of the list. Removing 1 item is OK. The version 10.4.4 was OK - issue started in 10.4.5.
We make a datagrid component which implements virtualized scrollling (i.e. adding/removing rows on the fly) and this issue totally kills the performance - i.e. full component repaint instead of just the affected rows.
Reproduction
Here is the static html page to reproduce the issue -
Steps to reproduce
Open the browser developer tools console and then slowly scroll the datagrid down either with mousewheel or scrollbar. The console should show added/removed rows, like
Scroll faster - as soon as you scroll more than 2 rows per 0.1s you will see something like this -
Expected Behavior
If you replace 10.4.5 with 10.4.4 then adding/removing rows works as expected, including more than 1 row at a time -
Tested with Chrome 83.0.4103.116 and Firefox 77.0.1
The text was updated successfully, but these errors were encountered: