Browse Source
The resource resolver in DevTools can cause performance degradation during application restarts in large projects. Key methods like isDeleted() and getAdditionalResources() rely on nested loops, leading to O(n*m) complexity. This commit refactors ClassLoaderFiles to use a pre-computed, flattened map. This provides O(1) complexity for direct lookups and allows for efficient single-loop iteration. The ClassLoaderFilesResourcePatternResolver is updated to leverage this new, efficient structure: - getFile() and size() are improved from O(n) to O(1). - isDeleted() and getAdditionalResources() are improved from O(n*m) to O(m) by eliminating nested loops. - Data consistency is maintained across all operations. This optimization significantly improves restart performance with a minimal memory footprint, while preserving the existing API and exception handling behavior. See gh-46289 Signed-off-by: DongHoon Lee <dhl1924@naver.com>pull/47012/head
2 changed files with 39 additions and 34 deletions
Loading…
Reference in new issue