franz1981 commented on pull request #3566:
URL: https://github.com/apache/activemq-artemis/pull/3566#issuecomment-832632624


   Results shows that with a long enough stream of packet types, `switch` 
perform slightly better then the `if cascade`:
   ```
   Benchmark                              (mostSeenProb)  (size)  Mode  Cnt   
Score   Error  Units
   SwitchVsIfCascadeBenchmark.testIf                  40    8192  avgt   16  
21.344 ± 1.075  ns/op
   SwitchVsIfCascadeBenchmark.testIf                  60    8192  avgt   16  
17.265 ± 0.091  ns/op
   SwitchVsIfCascadeBenchmark.testIf                  80    8192  avgt   16  
11.571 ± 0.046  ns/op
   SwitchVsIfCascadeBenchmark.testSwitch              40    8192  avgt   16  
19.416 ± 0.166  ns/op
   SwitchVsIfCascadeBenchmark.testSwitch              60    8192  avgt   16  
15.342 ± 0.074  ns/op
   SwitchVsIfCascadeBenchmark.testSwitch              80    8192  avgt   16  
10.942 ± 0.013  ns/op
   ```
   So there's no point to use the if one given that's a bit less readable too.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to