You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
MessageCracker generated class contains a lengthy if else statement to resolve the method call for the respective message type.
Current logic is about 7 times slower than using HashMap key'd by message type and value as the method reference.
I wrote a new MessageCracker.xsl which use the HashMap to resolve the method respective to message type.
Following is the JMH benchmarking results.
Before:
benchmarkCrackingGenerated - use the current MessageCracker.xls generated class
benchmarkCrackingWithHashMap use custom MessageCracker class which use HashMaps to resolve methods
benchmarkCrackingGenerated - use the new MessageCracker.xls generated class
benchmarkCrackingWithHashMap use custom MessageCracker class which use HashMaps to resolve methods
busy-spin
changed the title
Remove "if else" statements which is slower by nearly 7 time compared to HashMaps in generated MessageCracker class
Remove "if else" statements which is slower by nearly 7 times compared to HashMaps in generated MessageCracker class
Nov 20, 2022
Describe the bug
MessageCracker generated class contains a lengthy if else statement to resolve the method call for the respective message type.
Current logic is about 7 times slower than using HashMap key'd by message type and value as the method reference.
I wrote a new MessageCracker.xsl which use the HashMap to resolve the method respective to message type.
Following is the JMH benchmarking results.
Before:
benchmarkCrackingGenerated - use the current MessageCracker.xls generated class
benchmarkCrackingWithHashMap use custom MessageCracker class which use HashMaps to resolve methods
Benchmark Mode Cnt Score Error Units
MessageCrackerBenchmark.benchmarkCrackingGenerated thrpt 5 10923194.106 ± 2861197.934 ops/s
MessageCrackerBenchmark.benchmarkCrackingWithHashMap thrpt 5 69723897.515 ± 3242125.694 ops/s
After:
benchmarkCrackingGenerated - use the new MessageCracker.xls generated class
benchmarkCrackingWithHashMap use custom MessageCracker class which use HashMaps to resolve methods
Benchmark Mode Cnt Score Error Units
MessageCrackerBenchmark.benchmarkCrackingGenerated thrpt 5 71897498.754 ± 19147681.365 ops/s
MessageCrackerBenchmark.benchmarkCrackingWithHashMap thrpt 5 72165054.010 ± 4905711.116 ops/s
To Reproduce
Run my JMH benchmark code in my forked repo for QFJ
Before
Before Code Benchmark
After
After Code Benchmark
Expected behavior
N/A
system information:
Additional context
N/A
The text was updated successfully, but these errors were encountered: