Skip to content

Avoid unnecessary synthesizable annotation processing [SPR-16933] #21472

Closed
@spring-projects-issues

Description

@spring-projects-issues

Phil Webb opened SPR-16933 and commented

I've been looking at the performance involved with using the SimpleMetadataReader and I suspect that it might be possible to improve AnnotationUtils.

I started with the following application that simulates the class parsing involved in a typical Spring Boot application

https://gist.github.com/philwebb/a22ea7bf5b575abd058a748fe12838d0

This app takes about 130ms to read the metadata from those 106 classes.
If I change the code to use an empty ASM visitor, parsing takes ~30ms
Reading just class bytes into an array takes ~22ms (so ASM parsing itself is quite fast)

If I remove the code that visits annotations so no AnnotationAttributes are read, it takes ~60ms.

Looking at the profiler a lot of time is spent in AnnotationUtils so I created a second sample:

https://gist.github.com/philwebb/f7cdc99401af8e063853b2ed574e9277

The NAMES being used here are the same as were ultimately used with the first sample. This one is reading annotation data for 413 classes (starting from their String name) and it takes ~93ms.
 


Affects: 5.0.7

Attachments:

Issue Links:

0 votes, 6 watchers

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