-
Notifications
You must be signed in to change notification settings - Fork 168
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
Many eventhandlers slow page load significantly #7826
Comments
Some other ideas that could be considered
|
The constant pool & event data expression broken is completely at least for current Flow master version. For a single click listener on And when a lot of event data expressions are probably less than 11 characters that the key length is, it is actually sending more data for those than what would be sent if the json string was just serialized as-is (instead of a constant key). The good news is that is seems like a quite easy thing to fix. |
Stops creating a constant pool key eagerly as it was being created 11 times for a simple click listener after each data expression was evaluated. Next step is to also make it not create the MessageDigest over and over again. Part of #7826
Stops creating a constant pool key eagerly as it was being created 11 times for a simple click listener after each data expression was evaluated. Next step is to also make it not create the MessageDigest over and over again. Part of #7826
Stops creating a constant pool key eagerly as it was being created 11 times for a simple click listener after each event data expression was evaluated. The change improves the server side roundtrip processing time for 2000 buttons with click listeners from roughly 210ms to 130ms (-40%) by not eagerly creating the id using MessageDigest after evaluating each event data expression. Difference to buttons without any click listeners is still about x2 (65ms->130ms). Next step is to also make it not create the MessageDigest over and over again. Part of #7826
Stops creating a constant pool key eagerly as it was being created 11 times for a simple click listener after each event data expression was evaluated. The change improves the server side roundtrip processing time for 2000 buttons with click listeners from roughly 210ms to 130ms (-40%) by not eagerly creating the id using MessageDigest after evaluating each event data expression. Difference to buttons without any click listeners is still about x2 (65ms->130ms). Next step is to also make it not create the MessageDigest over and over again. Part of #7826
Stops creating a constant pool key eagerly as it was being created 11 times for a simple click listener after each event data expression was evaluated. The change improves the server side roundtrip processing time for 2000 buttons with click listeners from roughly 210ms to 130ms (-40%) by not eagerly creating the id using MessageDigest after evaluating each event data expression. Difference to buttons without any click listeners is still about x2 (65ms->130ms). Next step is to also make it not create the MessageDigest over and over again. Part of #7826
Stops creating a constant pool key eagerly as it was being created 11 times for a simple click listener after each event data expression was evaluated. The change improves the server side roundtrip processing time for 2000 buttons with click listeners from roughly 210ms to 130ms (-40%) by not eagerly creating the id using MessageDigest after evaluating each event data expression. Difference to buttons without any click listeners is still about x2 (65ms->130ms). Next step is to also make it not create the MessageDigest over and over again. Part of #7826 Co-authored-by: Pekka Hyvönen <[email protected]>
By fixing the bug (#12124) that caused the The difference to buttons without click listeners is still roughly x 2 (e.g. 65ms vs 130ms) and most of that comes from the additional work that is done from the server side for setting up the listeners and the event data etc. By reusing the (note that the calls for So, I think the low hanging fruit has been fixed already now (to be released to 14.7, 21+). I'm not sure if it is beneficial to try to do something else - like skipping the hashing completely for short enough event data strings. Probably the suggestion of
could bring the most impact, but it would also require quite much changes on the framework level. So, I'm not sure if I should just close this issue for now or not. I'll probably still make a PR about reusing the |
The alternatives for sharing that I'm aware of are:
|
Thanks for taking a look at this! Ill take a closer look once the next pre-release is released. Another low-hanging fruit: JreJsonObject.stringifyOrder uses String.matches(), which compiles a lot of patterns. This pattern object could be stored in a static field. |
Right, good point. I just put the For more complex sharing options, again I'm not sure if the added time investment and complexity is worth it or not. Maybe it would make more sense to not use the constant pool at all for smaller json objects. So maybe best thing for now is to do nothing.
It will be in Vaadin 22.0.0.beta1 and probably 21.0.4.
Yes, but this could be handled as part of another issue. As we are using a customized version of the Elemental json library, we could change it there, but then again we have been considering of switching to Jackson for json parsing. |
Stops creating a constant pool key eagerly as it was being created 11 times for a simple click listener after each event data expression was evaluated. The change improves the server side roundtrip processing time for 2000 buttons with click listeners from roughly 210ms to 130ms (-40%) by not eagerly creating the id using MessageDigest after evaluating each event data expression. Difference to buttons without any click listeners is still about x2 (65ms->130ms). Next step is to also make it not create the MessageDigest over and over again. Part of #7826 Co-authored-by: Pekka Hyvönen <[email protected]>
Well, should but there is no guarantee about it, so the safety of the sharing should be handled. But anyway when I profile the code without reusing the I'm going to close this issue as the reported thing has significantly improved, but in case you have any further concerns or findings, please just open a new issue and we'll take a look. |
Summary: Pages with a large number of eventhandlers load slowly, because of frequent, expensive SHA256 hash computation
Given the following “complex“ page, which takes roughly 2-3 seconds of servertime per click. Most of this time is spent while creating the Buttons
Flow version: 14.1.19
Expected behaviour: fast pageload
Actual behaviour: slow pageload
Profiling shows the following results:
Ideas:
The result is truncated to 64 bits anyways
Compression should take care of repeated elements.
The text was updated successfully, but these errors were encountered: