-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Rahul Shinde opened SPR-17344 and commented
For applications that get bundled as an uber jar, while benchmarking the startup timings, it was found that there is always a fixed cost associated with every lookup that is performed by PathMatchingResourcePatternResolver (PMRPR) while component scanning.
This is a result of opening up the jar file and traversing the entries each time when PMRPR is used to find the resources.
With 10K+ beans and large number of packages for component-scanning, this adds up pretty quick.
After adding a Memoized implementation of the PathMatchingResourcePatternResolver, the refresh timings dropped around 2-4 minutes depending on the hardware spec.
The Memoized implementation builds a cache when a given jar is looked up the very first time. For subsequent lookups, it simply does a binary search over the cached entries.
This memoized implementation is attached to the ApplicationContext by overriding getResourcePatternResolver(..)
It would be good to have this as an option for applications that want to use a memoized version of PMRPR.
Affects: 5.0.9, 5.1 GA
Referenced from: pull request #1981