Improve performance of assertion in StompSubProtocolHandler [SPR-14624] #19191
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: backported
An issue that has been backported to maintenance branches
type: enhancement
A general enhancement
Milestone
Christoph Dreis opened SPR-14624 and commented
Hey,
I just noticed a rather costly assertion in the websocket layer - more explicitly in StompSubProtocolHandler.convertConnectAcktoStompConnected().
As the framework is now using Java 8 features, I wanted to add methods in
Assert
that can make use of suppliers. But you already did that ;-)So I just used the new methods in an isolated test for a benchmark and the results show a crazy factor of 4300. I might be tricked by dead code elimination or some other compiler voodoo, because I don't trust those results.
Nevertheless, I changed the code to use the supplier methods in the attached PR.
Unfortunately, this will be only available in 5.x so I would appreciate a solution for 4.x that avoids the apparently rather costly assertion/string-concatenation of StompHeaderAccessor instances.
Best,
Christoph
Affects: 4.2.7, 4.3.2
Reference URL: #1138
Issue Links:
Referenced from: commits 0735e9b, 3811a59, 56b197b
Backported to: 4.2.8
The text was updated successfully, but these errors were encountered: