This repository reproduces the problem: https://github.com/maio/repro-thymeleaf-slow-urls-problem
When @{...}
syntax is used and project contains org.webjars:webjars-locator-lite
dependency, it takes much more time to generate resulting HTML.
A lot of time is being spent in ResourceUrlEncodingFilter.ResourceUrlEncodingResponseWrapper#encodeURL
.
Comment From: bclozel
@maio this is a bit by design... we're calling webjars-locator while encoding URLs to update the URLs to webjar resources.
If this is slower because of webjars-locator-lite itself, I would suggest raising an issue on the project directly with concrete profiling data to show where time is being spent and better understand if things can be optimized.
If this is slower because of "cache misses" when encoding URLs for resources that aren't static resources, then I guess this is a duplicate of https://github.com/spring-projects/spring-framework/issues/34014.
In both cases, I'm closing this issue as a duplicate. If you have concrete profiling data, please share them on #34014 or with the new webjars-locator issue you're about to create. Thanks!