When using router functions, the bulk of RequestPredicate execution is spent in attribute map merging. We should consider ways to improve this, for instance by using composite maps instead of allocating new ones.
Comment From: injae-kim
https://github.com/spring-projects/spring-framework/blob/6e9607ce999a01c942551f2d0c85107aa1d4f94b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/RouterFunctions.java#L1247
https://github.com/spring-projects/spring-framework/blob/6e9607ce999a01c942551f2d0c85107aa1d4f94b/spring-webmvc/src/main/java/org/springframework/web/servlet/function/RouterFunctions.java#L1267-L1269
What an interesting issue! I think we can use some CompositeMap
instead of UnmodifiableMap
& deep copy on every withAttributes()
on AttributesRouterFunction
.
(I'm not sure above is what this issue wants)
I fixed similar issue on another opensource before, so if you busy I can create PR :) thank you!
Comment From: poutsma
@injae-kim There are a lot of intrinsic details that can go wrong here, which has caused many regressions in the past. So I'd rather tackle this one myself, thanks!
Comment From: injae-kim
which has caused many regressions in the past.
Aha thanks for the explanation! I got it. Please share on this issue if there's something I can help 😃