dnrajugade / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Eventbus register() is very slow for large classes #1196

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If a class with many methods is registered with an event bus, the registration 
process takes a long time (in the attached example > 30 milliseconds on my 
machine and JDK1.7.0_04). Such large classes are often encountered when using 
component oriented GUI-Toolkits such as Swing/Vaadin/JSF.

The problem seems to be due to the AnnotatedHandlerFinder whose implementation 
throws+catches a lot of exceptions. Either caching should be introduced here 
(eg. Map<Class,Method>) or the lookup algorithm changed to not rely on 
exceptions (using getDeclaredMethods() for every level of the class hierarchy).

Original issue reported on code.google.com by nwir...@gmx.de on 7 Nov 2012 at 9:40

Attachments:

GoogleCodeExporter commented 9 years ago
AnnotatedHandlerFinder already uses caching 
(https://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/co
mmon/eventbus/AnnotatedHandlerFinder.java#46)...?

Original comment by wasserman.louis on 4 Feb 2013 at 5:35

GoogleCodeExporter commented 9 years ago
Fix to avoid using exceptions for control flow has been pushed internally; 
should be mirrored out externally in the next few days.

Original comment by lowas...@google.com on 4 Feb 2013 at 8:42

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:13

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08