-
Notifications
You must be signed in to change notification settings - Fork 37.7k
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
AnnotationUtils performance degrades with deep stacks #32921
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Milestone
Comments
This is available in current 6.1.9 / 6.0.22 / 5.3.37 snapshots already. Feel free to give it an early try! |
Dev testing confirms the change eliminated the NoSuchMethodExceptions. Thanks! :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Affects: 5.3.1 +
Profiling of a complex Spring-based web application shows a bottleneck in
AnnotationUtils.getValue()
that cannot be reproduced in JMH benchmarks. Further investigation showed the problem comes from generating deep stack traces in the exception cases (NoSuchMethodException
orThrowable
), and the JMH benchmark uses a very shallow stack (~5) while our application uses a rather deep one (~150). The depth comes largely from nested Tomcat filters, but Spring also contributes.Exception cases primarily result from lookups of
@javax.inject.Qualifier()
and attributevalue
, via the following stack trace:I've attached a speed test that reproduces the exception case, and contains an alternative implementation that is faster in all cases (I think). The test can reproduce different stack depths by changing the value of "stackDepth".
Results from my computer:
AnnotationUtilsSpeedTest.java.txt
The text was updated successfully, but these errors were encountered: