I noticed in some of my stresstests that DefaultUserDestinationResolver.resolveDestination() was popping up quite often as a hot method and found some possible improvements.
The attached PR restructures the code of DefaultUserDestinationResolver.resolveDestination() or more correctly DefaultUserDestinationResolver.parse() in the following ways:
Allow parse() to be inlined by extracting the logic of parsing subscription messages and normal messages to dedicated private methods.
(Previous) DefaultUserDestinationResolver::parse (458 bytes) hot method too big
Make the sourceDestination of a message part of the ParseResult in order to avoid getting it twice in the chain
Move the call to fetch the Principal of a Message only to the parts where it is needed
...
Please find the results of the JMH benchmarks attached. In a nutshell, we can see no regression (on the contrary) for messages of type SUBSCRIBE/UNSUBSCRIBE/MESSAGE and almost doubled performance for HEARTBEAT messages.
Christoph Dreis opened SPR-15602 and commented
Hey,
I noticed in some of my stresstests that
DefaultUserDestinationResolver.resolveDestination()
was popping up quite often as a hot method and found some possible improvements.The attached PR restructures the code of
DefaultUserDestinationResolver.resolveDestination()
or more correctlyDefaultUserDestinationResolver.parse()
in the following ways:parse()
to be inlined by extracting the logic of parsing subscription messages and normal messages to dedicated private methods.DefaultUserDestinationResolver::parse (458 bytes) hot method too big
DefaultUserDestinationResolver::parse (95 bytes) inline (hot)
sourceDestination
of a message part of theParseResult
in order to avoid getting it twice in the chainPrincipal
of aMessage
only to the parts where it is neededPlease find the results of the JMH benchmarks attached. In a nutshell, we can see no regression (on the contrary) for messages of type
SUBSCRIBE/UNSUBSCRIBE/MESSAGE
and almost doubled performance forHEARTBEAT
messages.Let me know what you think.
Cheers,
Christoph
Affects: 4.3.8
Attachments:
Referenced from: pull request #1439, and commits d3e3365, 0ef1623, 6aeb8ef
The text was updated successfully, but these errors were encountered: