Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-14636

Improve performance of StompCommand.getMessageType()

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.2.7, 4.3.2
    • Fix Version/s: 4.2.8, 4.3.3, 5.0 M2
    • Component/s: Messaging:WebSocket
    • Labels:
      None

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              christoph.dreis Christoph Dreis
              Last updater:
              Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 14 weeks, 2 days ago