-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
Eliminate redundant lookups of classes and annotations #30891
Conversation
@jengebr Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@jengebr Thank you for signing the Contributor License Agreement! |
Which usage of As for the |
Oh, and thanks for your optimization attempts there, that's much appreciated! I'd be happy to fine-tune the caching that we have there already etc. Any changes that make a measurable difference for you are worth investigating, finding out why existing caching does not cover it already. It's just that the right place to address such shortcomings is not always obvious (even to us). |
Thanks for reviewing this! Our apps run 5.2.x so it's always possible this is comes from a version difference. And you summarized the situation quite well with this:
Re: InjectionPoint, I see what you're saying, and I'll look upwards through the call tree to see what else may be at fault. Re: MethodInvoker, I'm not able to identify the specific bean configuration(s) causing this in production, but reinitialization is an interesting case that I hadn't considered, and it might explain all of this. It shouldn't be happening, but it's conceivable. Detailed stacks are below. The hot stack for MethodInvoker is:
and for InjectionPoint is:
|
The problem for With the |
This should be fully superseded by my resolution for #30883 now, covering all identified hotspots. |
Repeatedly instantiating beans can trigger redundant lookups of classes and parameter annotations, and in certain applications become noticeable performance issues. This change eliminates the redundant work by a) changing MethodInvoker.prepare() to only lookup targetClass when it's missing, and b) changing InjectionPoint to cache the method annotations similarly to the existing caching for field annotations.
Closes: #30883