Performance of Pattern Matching for switch (Third Preview)
Jordan Zimmerman
jordan at jordanzimmerman.com
Wed Aug 10 10:04:23 UTC 2022
Hi Folks,
I've been experimenting with Pattern Matching for switch (Third Preview). I noticed that the performance of these enhanced switches is far worse than manual matching. Is this due to this only being a preview and optimizations have yet to be done? Anyway, I thought I'd mention what I found as an FYI.
Here's the jmh benchmark I used:
https://gist.github.com/Randgalt/a68ceee62cd8127431cbe6e7afbfdf44 <https://gist.github.com/Randgalt/a68ceee62cd8127431cbe6e7afbfdf44>
Here are the results:
Benchmark Mode Cnt Score Error Units
TestEnhancedSwitch.testEnhancedSwitch thrpt 5 30789.482 ± 17667.365 ops/s
TestEnhancedSwitch.testManualSwitch thrpt 5 44651.612 ± 5135.641 ops/s
Cheers.
-Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20220810/1eabacaa/attachment-0001.htm>
More information about the amber-dev
mailing list