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
Revise ResolvableType.as for introspection performance (limiting serializability) [SPR-17070] #21608
Comments
Juergen Hoeller commented I'm rather keen on optimizing |
Dave Syer commented Indeed that would have benefits in many other places. Good luck! |
Andy Clement commented Just my 2c as I see the code above - I was exploring other uses of getUniqueDeclaredMethods() yesterday. I found a few places ask for them all and then immediately ignoring most of them. So I was fiddling with creating a variant of getUniqueDeclaredMethods() that took a methodfilter and just passed it down into the doWithMethods() that getUniqueDeclaredMethods() calls. In the above case (for example) it would be like: for (Method candidate: ReflectionUtils.getFilteredUniqueDeclaredMethods(listenerType, m->m.getName().equals("onApplicationEvent")) { (I suppose here you could possibly even be quicker since you want to exit it on the first one if ReflectionUtils returned a stream of methods and you could stop on the first that met the condition). Just an observation...
|
Juergen Hoeller commented It turns out that If some of our portfolio projects happen to rely on serializability of derived |
Dave Syer commented Excellent! This will have a big effect on performance for a large class of apps. |
Dave Syer opened SPR-17070 and commented
After #21508? we now have some caching in
GenericApplicationListenerAdapter
which helps a bit. Unfortunately I still see the app losing 2.5% of startup time toGenericApplicationListenerAdapter
while the multicaster checks each listener for supported event types. The culprit isResolvableType.as()
(where it looks for all interfaces).I tried this and it works and is much faster:
Whether or not that is general enough is beyond me, but it has a big effect on the tiny apps I have been benchmarking.
Affects: 5.1 RC1
Reference URL: #21508
Issue Links:
Referenced from: commits cfbacfd
The text was updated successfully, but these errors were encountered: