-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
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 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
- (After)
DefaultUserDestinationResolver::parse (95 bytes) inline (hot)
- (Previous)
- Make the
sourceDestination
of a message part of theParseResult
in order to avoid getting it twice in the chain - Move the call to fetch the
Principal
of aMessage
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.
Let me know what you think.
Cheers,
Christoph
Affects: 4.3.8
Attachments:
- benchmark_results.txt (5.58 kB)
Referenced from: pull request #1439, and commits d3e3365, 0ef1623, 6aeb8ef