Improve performance of getGenericMapResponse #2873
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I migrate a bigger project from Springfox to Springdoc 1.8.0 (as a temporary step) and to Springdoc 2.8.3.
With Springfox the performance to generate the API definition was pretty good with approximately 5 seconds. After migrating to Springdoc 1.8.0 this increased to 20 seconds. Since the calculation happens only once this was still ok.
But with the update to Springdoc 2.8.3 it increased considerably. Now it takes 120 seconds to generate the same API definition.
I did some profiling and found this easy fix to help improve performance a little. With this fix I'm now down to 83 seconds. This is still too high and I'll try to find further improvements.
Here is a screenshot of the CPU time analysis in JProfiler. As you can see, the call to
ControllerAdviceBean.findAnnotatedBeans(applicationContext)
is quite expensive in total.