Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-16933

Avoid unnecessary synthesizable annotation processing

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 5.0.7
    • Fix Version/s: 5.0.9, 5.1 RC2
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      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

            Activity

              People

              Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              pwebb Phil Webb
              Last updater:
              Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 2 weeks ago