Skip to content
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

Vaadin 7.3 : Optimize AbstractClientConnector.getAllComponentsIterable() #5380

Closed
vaadin-bot opened this issue Jul 3, 2014 · 5 comments
Closed

Comments

@vaadin-bot
Copy link
Collaborator

Originally by CodingFabian


Profiling revealed that there are enormous amounts of Iterables created in the above mentioned method.

com/vaadin/server/AbstractClientConnector$AllChildrenIterable
com/vaadin/server/AbstractClientConnector$CombinedIterator

This is wasting CPU and especially creating unnecessary GC pressure.
There is in most cases no need to wrap the Connectors at all. Either the iterable for the extensions, or the iterable for the components could be returned. Only in the case that a component has both extensions and components, a combined iterable needs to be created.

I am submitting a review, but it has a minor API change, so has to be targeted for 7.3


Imported from https://dev.vaadin.com/ issue #14142

@vaadin-bot
Copy link
Collaborator Author

Originally by CodingFabian


https://dev.vaadin.com/review/#/c/3924

@vaadin-bot
Copy link
Collaborator Author

Originally by @Legioth


Thank you for your patch!

@vaadin-bot
Copy link
Collaborator Author

Originally by CodingFabian


FYI: I just did a few comparisons for a blog post.

For the same set of actions performed by a short testbench test on our application the pre-patch code was creating 9442 instances of AllChildrenIterable and 9942 instances of CombinedIterator.

After the patch it only created AbstractClientConnector$1 and AbstractClientConnector$1$1 32 times - quite a difference.

I expect most other real applications to have about the same ratio. The only component having both child components and extensions which is frequently used would be DragAndDropWrapper, I assume.

@vaadin-bot
Copy link
Collaborator Author

Originally by @Legioth


Sounds like very excellent results!

Do you have any measurements or guesstimates on how this change might affect actual runtime performance?

Other components that are expected to have both child components and extensions are UI and the upcoming Grid, but they are both such that you typically don't have very many instances active in the same view.

@vaadin-bot
Copy link
Collaborator Author

Originally by CodingFabian


Hi Leif,

no I have note done any benchmarks.
Speed wise, I think this is very minor. The old code did create objects, the new code does a bit more checking.

If you have small component trees then this change is most likely not measurable in terms of speedups. only with big trees it could give a few ms.

What it however does is to reduce the pressure on the garbage collector, which is not a problem under low load, but turns out to be a big problem under load.

There are a few other places in vaadin which do excessive object allocation, and I will work on them as soon as I have the 7.2.x upgrade done on our application.

If I look at hotspots right now it would be Connector-iteration and JSON generation (including diffing) both on client and server side. Thats why I had done a few patches for JsonCodec and related recently.

@vaadin-bot vaadin-bot added the bug label Dec 10, 2016
@vaadin-bot vaadin-bot added this to the Vaadin 7.3.0.beta1 milestone Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant