Skip to content

Optimize ordered event listener performance [SPR-14642] #19208

Closed
@spring-projects-issues

Description

@spring-projects-issues

Christoph Dreis opened SPR-14642 and commented

Hey,

while doing some loadtests in our project, I noticed that AnnotatedElementUtils.searchWithFindSemantics() or rather AnnotatedElementUtils.findMergedAnnotation() are consuming quite some CPU. It's even above HashMap.getNode(int, Object) in some tests, which I find quite precarious for such a utility class. It looks like this is especially true for using @Order somewhere in the application in combination with @EventListener functionality.

I was wondering if this could be improved in any way? Maybe by caching merged annotation lookups much like in AnnotationUtils. Or maybe by just caching the order in the ApplicationListener context.

!annotated_element_utils_jmc.jpg|thumbnail!

Cheers,
Christoph


Affects: 4.3.2

Attachments:

Issue Links:

Referenced from: commits 58fa63f, 3b91dec

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions