Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of StompCommand.getMessageType() [SPR-14636] #19203

Closed
spring-projects-issues opened this issue Aug 28, 2016 · 1 comment
Closed
Assignees
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

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Aug 28, 2016

Christoph Dreis opened SPR-14636 and commented

Hey,

I was doing some benchmarks of StompCommand.getMessageType() in order to improve it a bit. While doing so, I noticed that the underlying map of stomp commands can be turned into an EnumMap.

Benchmark Mode Cnt Score Error Units
MyBenchmark.getMessageTypeBefore thrpt 30 163519811,370 ± 8667018,099 ops/s
MyBenchmark.getMessageTypeNew thrpt 30 222591672,767 ± 4476266,088 ops/s

As you can see there is ~36% performance increase.

Cheers,
Christoph


Affects: 4.2.7, 4.3.2

Reference URL: #1148

Issue Links:

Referenced from: commits aa12288, 899ebd8, 8e98177

Backported to: 4.2.8

@spring-projects-issues
Copy link
Collaborator Author

Christoph Dreis commented

Based on the feedback in the PR i removed the Map completely and achieved the following results:

Benchmark Mode Cnt Score Error Units
MyBenchmark.getMessageTypeBefore thrpt 30 163519811,370 ± 8667018,099 ops/s
MyBenchmark.getMessageTypeNew thrpt 30 222591672,767 ± 4476266,088 ops/s
MyBenchmark.getMessageTypeWithoutMap thrpt 30 344417784,452 ± 3512819,401 ops/s

@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3.3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants