Details
Description
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.
Attachments
Issue Links
- is related to
-
SPR-17160 Spring internal configuration classes can no longer use @EventListener
-
- Closed
-
-
SPR-17166 @Scheduled task runs twice on bean with target-class scoped proxy (when injected)
-
- Closed
-
- relates to
-
SPR-16060 Annotations on generic interface methods not found by AnnotationUtils
-
- Closed
-
-
SPR-16667 Reduce ClassUtils.forName overhead (in particular for annotation introspection purposes)
-
- Closed
-
-
SPR-16675 Comprehensively cache annotated methods for interfaces and superclasses
-
- Closed
-
-
SPR-16730 Avoid repeated superclass introspection in AnnotationUtils.findAnnotation
-
- Closed
-