Improve performance of StompEncoder.encode() [SPR-14747] #19313
I just noticed a rather costly assertion in the websocket layer - more explicitly in StompEncoder.encode(). Sorry I didn't notice this earlier in order to bring this to 4.3.3.
It is very similar to #19191, but has a much bigger impact on websocket applications as its executed on basically every message apart from heartbeats. Apart from the JMH benchmarks below, which show a factor of ~1200, the Assert statement in question produced more than 60GB of heap pressure in just 20 seconds. Mostly coming from the string concatenation of course.
Much like the fix for #19191 I switched from Assert.notNull to a simple null check with an IllegalStateException.
While looking into StompEncoder I also moved one variable declaration a bit down, which was not needed in every-case. I hope you don't mind.
Affects: 4.2.8, 4.3.3
Reference URL: #1185
Backported to: 4.2.9
The text was updated successfully, but these errors were encountered: