-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Possible optimization in UrlResource #25531
Copy link
Copy link
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement
Milestone
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement
Type
Fields
Give feedbackNo fields configured for issues without a type.
UrlResourcecomputes acleanedUrlin its constructor, but only uses it in a small number of methods (e.g.hashCode()). It has someStringmanipulations in it that can be expensive, so it might make sense to compute it lazily.Some benchmarks (instantiate a
FileUrlResourceand check if itexists()):I think the fact that the median comparison is much more dramatic is probably because of garbage collection, which is quite noisy, and would be more common in the default case.
Spring Boot computes quite a few of these
FileUrlResourceson startup as it searches forapplication.propertiesfiles. The difference is just about noticeable (a few milliseconds on startup, and fewer GC failures).