Skip to content

Instantly share code, notes, and snippets.

@Janmm14
Last active June 21, 2021 13:37
Show Gist options
  • Save Janmm14/253f1f7f4d115a430df1263cbc33754e to your computer and use it in GitHub Desktop.
Save Janmm14/253f1f7f4d115a430df1263cbc33754e to your computer and use it in GitHub Desktop.
First, simple and smaller EventBus speed test
Reflection: Lambda:
Benchmark Mode Cnt Score Error Units Score Error Units
SpeedTest.bench2Event thrpt 6 92006,731 ± 77,695 ops/ms 161322,551 ± 424,899 ops/ms
SpeedTest.bench2Event2 thrpt 6 92157,840 ± 26,738 ops/ms 163908,712 ± 366,460 ops/ms
SpeedTest.bench2Event3 thrpt 6 46152,362 ± 40,995 ops/ms 84655,500 ± 228,741 ops/ms
SpeedTest.bench2Event_ thrpt 6 93812,233 ± 14,346 ops/ms 162947,301 ± 119,321 ops/ms
SpeedTest.benchBlackhole thrpt 6 106688,489 ± 62,771 ops/ms 193382,220 ± 1528,584 ops/ms
SpeedTest.benchEvent thrpt 6 579507,353 ± 2159,839 ops/ms 721905,842 ± 2497,878 ops/ms
SpeedTest.benchEvent2 thrpt 6 592207,103 ± 2435,624 ops/ms 752155,256 ± 7021,049 ops/ms
SpeedTest.benchEventNew thrpt 6 91279,936 ± 76,264 ops/ms 169623,519 ± 166,267 ops/ms
SpeedTest.benchNew thrpt 6 388415,688 ± 3125,751 ops/ms 391323,496 ± 437,925 ops/ms
package net.md_5.bungee.event;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;
@Fork(1)
@State(Scope.Benchmark)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Warmup(iterations = 5, time = 4)
@Measurement(iterations = 6, time = 10)
public class SpeedTest
{
public static final EventBus bus = new EventBus();
public static Blackhole blackhole;
@Setup
public void setup(Blackhole blackhole)
{
SpeedTest.blackhole = blackhole;
bus.register( new EvListener() );
try
{
Thread.sleep( 15 * 1000 );
} catch ( InterruptedException e )
{
e.printStackTrace();
}
}
// reflection: 106688,489 ± 62,771 ops/ms
// lambda: 193382,220 ± 1528,584 ops/ms
@Benchmark
public void benchBlackhole(Blackhole event)
{
bus.post( event );
}
// reflection: 579507,353 ± 2159,839 ops/ms
// lambda: 721905,842 ± 2497,878 ops/ms
@Benchmark
public void benchEvent(Event event)
{
bus.post( event );
}
// reflection: 592207,103 ± 2435,624 ops/ms
// lambda: 752155,256 ± 7021,049 ops/ms
@Benchmark
public void benchEvent2(Event2 event)
{
bus.post( event );
}
// reflection: 91279,936 ± 76,264 ops/ms
// lambda: 169623,519 ± 166,267 ops/ms
@Benchmark
public void benchEventNew()
{
bus.post( new Event3() );
}
// reflection: 388415,688 ± 3125,751 ops/ms
// lambda: 391323,496 ± 437,925 ops/ms
@Benchmark
public void benchNew(Blackhole blackhole)
{
blackhole.consume( new Event3() );
}
// reflection: 46152,362 ± 40,995 ops/ms
// lambda: 84655,500 ± 228,741 ops/ms
@Benchmark
public void bench2Event3(Blackhole blackhole)
{
bus.post( blackhole );
bus.post( new Event3() );
}
// reflection: 93812,233 ± 14,346 ops/ms
// lambda: 162947,301 ± 119,321 ops/ms
@Benchmark
public void bench2Event_(Blackhole blackhole, Event event)
{
bus.post( blackhole );
bus.post( event );
}
// reflection: 92157,840 ± 26,738 ops/ms
// lambda: 163908,712 ± 366,460 ops/ms
@Benchmark
public void bench2Event2(Event2 event2, Blackhole blackhole)
{
bus.post( blackhole );
bus.post( event2 );
}
// reflection: 92006,731 ± 77,695 ops/ms
// lambda: 161322,551 ± 424,899 ops/ms
@Benchmark
public void bench2Event(Event event, Blackhole blackhole)
{
bus.post( event );
bus.post( blackhole );
}
@State(Scope.Thread)
public static class Event
{
}
@State(Scope.Thread)
public static class Event2
{
}
public static class Event3
{
}
public static class Event4
{
}
public static class EvListener
{
@EventHandler
public void onEvent(Event event)
{
SpeedTest.blackhole.consume( event );
}
@EventHandler
public void onEvent(Event2 event)
{
SpeedTest.blackhole.consume( event );
}
@EventHandler
public void onEvent(Event3 event)
{
SpeedTest.blackhole.consume( event );
}
@EventHandler
public void onEvent(Blackhole event)
{
event.consume( event );
}
@EventHandler
public void onEvent(Event4 event)
{
SpeedTest.blackhole.consume( event );
}
}
}
"C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin" -Dfile.encoding=UTF-8 -classpath H:\C\Users\*\IdeaProjects\BungeeCord\event\target\test-classes;H:\C\Users\*\IdeaProjects\BungeeCord\event\target\classes;H:\C\Users\*\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.20\animal-sniffer-annotations-1.20.jar;H:\C\Users\*\.m2\repository\org\openjdk\jmh\jmh-core\1.32\jmh-core-1.32.jar;H:\C\Users\*\.m2\repository\net\sf\jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar;H:\C\Users\*\.m2\repository\org\apache\commons\commons-math3\3.2\commons-math3-3.2.jar;H:\C\Users\*\.m2\repository\org\openjdk\jmh\jmh-generator-annprocess\1.32\jmh-generator-annprocess-1.32.jar;H:\C\Users\*\.m2\repository\junit\junit\4.13.1\junit-4.13.1.jar;H:\C\Users\*\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;H:\C\Users\*\.m2\repository\com\google\guava\guava\21.0\guava-21.0.jar;H:\C\Users\*\.m2\repository\com\google\code\findbugs\findbugs-annotations\3.0.1\findbugs-annotations-3.0.1.jar;H:\C\Users\*\.m2\repository\org\projectlombok\lombok\1.18.20\lombok-1.18.20.jar org.openjdk.jmh.Main "net.md_5.bungee.event.SpeedTest.*"
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.bench2Event
# Run progress: 0,00% complete, ETA 00:12:00
# Fork: 1 of 1
# Warmup Iteration 1: 111467,306 ops/ms
# Warmup Iteration 2: 91313,014 ops/ms
# Warmup Iteration 3: 92034,291 ops/ms
# Warmup Iteration 4: 91996,847 ops/ms
# Warmup Iteration 5: 91965,145 ops/ms
Iteration 1: 91953,235 ops/ms
Iteration 2: 92029,749 ops/ms
Iteration 3: 92024,195 ops/ms
Iteration 4: 92018,214 ops/ms
Iteration 5: 92005,423 ops/ms
Iteration 6: 92009,573 ops/ms
Result "net.md_5.bungee.event.SpeedTest.bench2Event":
92006,731 ±(99.9%) 77,695 ops/ms [Average]
(min, avg, max) = (91953,235, 92006,731, 92029,749), stdev = 27,707
CI (99.9%): [91929,037, 92084,426] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.bench2Event2
# Run progress: 11,11% complete, ETA 00:12:46
# Fork: 1 of 1
# Warmup Iteration 1: 113228,940 ops/ms
# Warmup Iteration 2: 90001,885 ops/ms
# Warmup Iteration 3: 92117,956 ops/ms
# Warmup Iteration 4: 92159,675 ops/ms
# Warmup Iteration 5: 92137,516 ops/ms
Iteration 1: 92165,119 ops/ms
Iteration 2: 92146,363 ops/ms
Iteration 3: 92154,669 ops/ms
Iteration 4: 92163,372 ops/ms
Iteration 5: 92169,424 ops/ms
Iteration 6: 92148,092 ops/ms
Result "net.md_5.bungee.event.SpeedTest.bench2Event2":
92157,840 ±(99.9%) 26,738 ops/ms [Average]
(min, avg, max) = (92146,363, 92157,840, 92169,424), stdev = 9,535
CI (99.9%): [92131,102, 92184,578] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.bench2Event3
# Run progress: 22,22% complete, ETA 00:11:10
# Fork: 1 of 1
# Warmup Iteration 1: 62953,463 ops/ms
# Warmup Iteration 2: 44784,715 ops/ms
# Warmup Iteration 3: 46150,541 ops/ms
# Warmup Iteration 4: 46072,823 ops/ms
# Warmup Iteration 5: 46130,854 ops/ms
Iteration 1: 46170,837 ops/ms
Iteration 2: 46138,058 ops/ms
Iteration 3: 46154,357 ops/ms
Iteration 4: 46142,260 ops/ms
Iteration 5: 46168,629 ops/ms
Iteration 6: 46140,033 ops/ms
Result "net.md_5.bungee.event.SpeedTest.bench2Event3":
46152,362 ±(99.9%) 40,995 ops/ms [Average]
(min, avg, max) = (46138,058, 46152,362, 46170,837), stdev = 14,619
CI (99.9%): [46111,367, 46193,358] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.bench2Event_
# Run progress: 33,33% complete, ETA 00:09:34
# Fork: 1 of 1
# Warmup Iteration 1: 107699,407 ops/ms
# Warmup Iteration 2: 90275,131 ops/ms
# Warmup Iteration 3: 93848,135 ops/ms
# Warmup Iteration 4: 93810,877 ops/ms
# Warmup Iteration 5: 93813,954 ops/ms
Iteration 1: 93818,398 ops/ms
Iteration 2: 93814,039 ops/ms
Iteration 3: 93812,207 ops/ms
Iteration 4: 93815,374 ops/ms
Iteration 5: 93809,712 ops/ms
Iteration 6: 93803,667 ops/ms
Result "net.md_5.bungee.event.SpeedTest.bench2Event_":
93812,233 ±(99.9%) 14,346 ops/ms [Average]
(min, avg, max) = (93803,667, 93812,233, 93818,398), stdev = 5,116
CI (99.9%): [93797,887, 93826,579] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchBlackhole
# Run progress: 44,44% complete, ETA 00:07:59
# Fork: 1 of 1
# Warmup Iteration 1: 143432,749 ops/ms
# Warmup Iteration 2: 109215,794 ops/ms
# Warmup Iteration 3: 106683,485 ops/ms
# Warmup Iteration 4: 106623,236 ops/ms
# Warmup Iteration 5: 106666,314 ops/ms
Iteration 1: 106647,958 ops/ms
Iteration 2: 106694,844 ops/ms
Iteration 3: 106716,217 ops/ms
Iteration 4: 106685,637 ops/ms
Iteration 5: 106692,129 ops/ms
Iteration 6: 106694,146 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchBlackhole":
106688,489 ±(99.9%) 62,771 ops/ms [Average]
(min, avg, max) = (106647,958, 106688,489, 106716,217), stdev = 22,385
CI (99.9%): [106625,718, 106751,260] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchEvent
# Run progress: 55,56% complete, ETA 00:06:23
# Fork: 1 of 1
# Warmup Iteration 1: 579642,744 ops/ms
# Warmup Iteration 2: 580708,871 ops/ms
# Warmup Iteration 3: 581461,407 ops/ms
# Warmup Iteration 4: 579333,211 ops/ms
# Warmup Iteration 5: 580570,347 ops/ms
Iteration 1: 578767,670 ops/ms
Iteration 2: 580028,850 ops/ms
Iteration 3: 578313,381 ops/ms
Iteration 4: 580041,133 ops/ms
Iteration 5: 580105,971 ops/ms
Iteration 6: 579787,116 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchEvent":
579507,353 ±(99.9%) 2159,839 ops/ms [Average]
(min, avg, max) = (578313,381, 579507,353, 580105,971), stdev = 770,220
CI (99.9%): [577347,514, 581667,193] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchEvent2
# Run progress: 66,67% complete, ETA 00:04:47
# Fork: 1 of 1
# Warmup Iteration 1: 524256,914 ops/ms
# Warmup Iteration 2: 563430,264 ops/ms
# Warmup Iteration 3: 592547,009 ops/ms
# Warmup Iteration 4: 590236,311 ops/ms
# Warmup Iteration 5: 592478,324 ops/ms
Iteration 1: 590877,475 ops/ms
Iteration 2: 592201,451 ops/ms
Iteration 3: 591870,211 ops/ms
Iteration 4: 591988,938 ops/ms
Iteration 5: 592984,468 ops/ms
Iteration 6: 593320,078 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchEvent2":
592207,103 ±(99.9%) 2435,624 ops/ms [Average]
(min, avg, max) = (590877,475, 592207,103, 593320,078), stdev = 868,567
CI (99.9%): [589771,479, 594642,728] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchEventNew
# Run progress: 77,78% complete, ETA 00:03:11
# Fork: 1 of 1
# Warmup Iteration 1: 115435,449 ops/ms
# Warmup Iteration 2: 89309,590 ops/ms
# Warmup Iteration 3: 91316,945 ops/ms
# Warmup Iteration 4: 91280,042 ops/ms
# Warmup Iteration 5: 91069,396 ops/ms
Iteration 1: 91275,065 ops/ms
Iteration 2: 91265,767 ops/ms
Iteration 3: 91255,270 ops/ms
Iteration 4: 91292,933 ops/ms
Iteration 5: 91328,643 ops/ms
Iteration 6: 91261,935 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchEventNew":
91279,936 ±(99.9%) 76,264 ops/ms [Average]
(min, avg, max) = (91255,270, 91279,936, 91328,643), stdev = 27,197
CI (99.9%): [91203,671, 91356,200] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=64394:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchNew
# Run progress: 88,89% complete, ETA 00:01:35
# Fork: 1 of 1
# Warmup Iteration 1: 288311,614 ops/ms
# Warmup Iteration 2: 292620,840 ops/ms
# Warmup Iteration 3: 389276,828 ops/ms
# Warmup Iteration 4: 389299,631 ops/ms
# Warmup Iteration 5: 389352,908 ops/ms
Iteration 1: 389298,180 ops/ms
Iteration 2: 389336,430 ops/ms
Iteration 3: 386652,108 ops/ms
Iteration 4: 387624,395 ops/ms
Iteration 5: 388259,025 ops/ms
Iteration 6: 389323,993 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchNew":
388415,688 ±(99.9%) 3125,751 ops/ms [Average]
(min, avg, max) = (386652,108, 388415,688, 389336,430), stdev = 1114,673
CI (99.9%): [385289,937, 391541,439] (assumes normal distribution)
# Run complete. Total time: 00:14:22
REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
experiments, perform baseline and negative tests that provide experimental control, make sure
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
Do not assume the numbers tell you what you want them to tell.
Benchmark Mode Cnt Score Error Units
SpeedTest.bench2Event thrpt 6 92006,731 ± 77,695 ops/ms
SpeedTest.bench2Event2 thrpt 6 92157,840 ± 26,738 ops/ms
SpeedTest.bench2Event3 thrpt 6 46152,362 ± 40,995 ops/ms
SpeedTest.bench2Event_ thrpt 6 93812,233 ± 14,346 ops/ms
SpeedTest.benchBlackhole thrpt 6 106688,489 ± 62,771 ops/ms
SpeedTest.benchEvent thrpt 6 579507,353 ± 2159,839 ops/ms
SpeedTest.benchEvent2 thrpt 6 592207,103 ± 2435,624 ops/ms
SpeedTest.benchEventNew thrpt 6 91279,936 ± 76,264 ops/ms
SpeedTest.benchNew thrpt 6 388415,688 ± 3125,751 ops/ms
Process finished with exit code 0
"C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin" -Dfile.encoding=UTF-8 -classpath H:\C\Users\*\IdeaProjects\BungeeCord\event\target\test-classes;H:\C\Users\*\IdeaProjects\BungeeCord\event\target\classes;H:\C\Users\*\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.20\animal-sniffer-annotations-1.20.jar;H:\C\Users\*\.m2\repository\org\openjdk\jmh\jmh-core\1.32\jmh-core-1.32.jar;H:\C\Users\*\.m2\repository\net\sf\jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar;H:\C\Users\*\.m2\repository\org\apache\commons\commons-math3\3.2\commons-math3-3.2.jar;H:\C\Users\*\.m2\repository\org\openjdk\jmh\jmh-generator-annprocess\1.32\jmh-generator-annprocess-1.32.jar;H:\C\Users\*\.m2\repository\junit\junit\4.13.1\junit-4.13.1.jar;H:\C\Users\*\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;H:\C\Users\*\.m2\repository\com\google\guava\guava\21.0\guava-21.0.jar;H:\C\Users\*\.m2\repository\com\google\code\findbugs\findbugs-annotations\3.0.1\findbugs-annotations-3.0.1.jar;H:\C\Users\*\.m2\repository\org\projectlombok\lombok\1.18.20\lombok-1.18.20.jar org.openjdk.jmh.Main "net.md_5.bungee.event.SpeedTest.*"
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.bench2Event
# Run progress: 0,00% complete, ETA 00:12:00
# Fork: 1 of 1
# Warmup Iteration 1: 162130,404 ops/ms
# Warmup Iteration 2: 162924,618 ops/ms
# Warmup Iteration 3: 161513,810 ops/ms
# Warmup Iteration 4: 161228,550 ops/ms
# Warmup Iteration 5: 161161,290 ops/ms
Iteration 1: 161320,052 ops/ms
Iteration 2: 161134,287 ops/ms
Iteration 3: 161354,996 ops/ms
Iteration 4: 161162,650 ops/ms
Iteration 5: 161449,302 ops/ms
Iteration 6: 161514,018 ops/ms
Result "net.md_5.bungee.event.SpeedTest.bench2Event":
161322,551 ±(99.9%) 424,899 ops/ms [Average]
(min, avg, max) = (161134,287, 161322,551, 161514,018), stdev = 151,523
CI (99.9%): [160897,652, 161747,449] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.bench2Event2
# Run progress: 11,11% complete, ETA 00:12:48
# Fork: 1 of 1
# Warmup Iteration 1: 163195,219 ops/ms
# Warmup Iteration 2: 163404,352 ops/ms
# Warmup Iteration 3: 163434,149 ops/ms
# Warmup Iteration 4: 163958,127 ops/ms
# Warmup Iteration 5: 163969,719 ops/ms
Iteration 1: 163687,142 ops/ms
Iteration 2: 163886,236 ops/ms
Iteration 3: 163959,243 ops/ms
Iteration 4: 164086,531 ops/ms
Iteration 5: 163943,905 ops/ms
Iteration 6: 163889,212 ops/ms
Result "net.md_5.bungee.event.SpeedTest.bench2Event2":
163908,712 ±(99.9%) 366,460 ops/ms [Average]
(min, avg, max) = (163687,142, 163908,712, 164086,531), stdev = 130,683
CI (99.9%): [163542,251, 164275,172] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.bench2Event3
# Run progress: 22,22% complete, ETA 00:11:11
# Fork: 1 of 1
# Warmup Iteration 1: 87716,186 ops/ms
# Warmup Iteration 2: 89165,465 ops/ms
# Warmup Iteration 3: 84690,697 ops/ms
# Warmup Iteration 4: 84690,335 ops/ms
# Warmup Iteration 5: 84675,365 ops/ms
Iteration 1: 84697,107 ops/ms
Iteration 2: 84499,958 ops/ms
Iteration 3: 84628,769 ops/ms
Iteration 4: 84702,602 ops/ms
Iteration 5: 84698,149 ops/ms
Iteration 6: 84706,418 ops/ms
Result "net.md_5.bungee.event.SpeedTest.bench2Event3":
84655,500 ±(99.9%) 228,741 ops/ms [Average]
(min, avg, max) = (84499,958, 84655,500, 84706,418), stdev = 81,571
CI (99.9%): [84426,760, 84884,241] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.bench2Event_
# Run progress: 33,33% complete, ETA 00:09:35
# Fork: 1 of 1
# Warmup Iteration 1: 162422,164 ops/ms
# Warmup Iteration 2: 160292,911 ops/ms
# Warmup Iteration 3: 163005,170 ops/ms
# Warmup Iteration 4: 163049,866 ops/ms
# Warmup Iteration 5: 162940,998 ops/ms
Iteration 1: 162964,756 ops/ms
Iteration 2: 162991,381 ops/ms
Iteration 3: 162891,927 ops/ms
Iteration 4: 162957,572 ops/ms
Iteration 5: 162897,261 ops/ms
Iteration 6: 162980,910 ops/ms
Result "net.md_5.bungee.event.SpeedTest.bench2Event_":
162947,301 ±(99.9%) 119,321 ops/ms [Average]
(min, avg, max) = (162891,927, 162947,301, 162991,381), stdev = 42,551
CI (99.9%): [162827,980, 163066,623] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchBlackhole
# Run progress: 44,44% complete, ETA 00:07:59
# Fork: 1 of 1
# Warmup Iteration 1: 198113,117 ops/ms
# Warmup Iteration 2: 186822,977 ops/ms
# Warmup Iteration 3: 191505,207 ops/ms
# Warmup Iteration 4: 193219,591 ops/ms
# Warmup Iteration 5: 193621,046 ops/ms
Iteration 1: 193778,778 ops/ms
Iteration 2: 193835,856 ops/ms
Iteration 3: 193905,120 ops/ms
Iteration 4: 193277,588 ops/ms
Iteration 5: 192877,983 ops/ms
Iteration 6: 192617,994 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchBlackhole":
193382,220 ±(99.9%) 1528,584 ops/ms [Average]
(min, avg, max) = (192617,994, 193382,220, 193905,120), stdev = 545,108
CI (99.9%): [191853,636, 194910,804] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchEvent
# Run progress: 55,56% complete, ETA 00:06:23
# Fork: 1 of 1
# Warmup Iteration 1: 721666,586 ops/ms
# Warmup Iteration 2: 631305,304 ops/ms
# Warmup Iteration 3: 721073,503 ops/ms
# Warmup Iteration 4: 722321,891 ops/ms
# Warmup Iteration 5: 722669,284 ops/ms
Iteration 1: 722513,535 ops/ms
Iteration 2: 722950,172 ops/ms
Iteration 3: 720335,694 ops/ms
Iteration 4: 721797,632 ops/ms
Iteration 5: 721796,548 ops/ms
Iteration 6: 722041,470 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchEvent":
721905,842 ±(99.9%) 2497,878 ops/ms [Average]
(min, avg, max) = (720335,694, 721905,842, 722950,172), stdev = 890,767
CI (99.9%): [719407,964, 724403,719] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchEvent2
# Run progress: 66,67% complete, ETA 00:04:47
# Fork: 1 of 1
# Warmup Iteration 1: 722490,726 ops/ms
# Warmup Iteration 2: 738525,548 ops/ms
# Warmup Iteration 3: 754635,854 ops/ms
# Warmup Iteration 4: 754250,722 ops/ms
# Warmup Iteration 5: 753508,042 ops/ms
Iteration 1: 754155,985 ops/ms
Iteration 2: 748532,416 ops/ms
Iteration 3: 752706,497 ops/ms
Iteration 4: 753950,261 ops/ms
Iteration 5: 754076,654 ops/ms
Iteration 6: 749509,723 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchEvent2":
752155,256 ±(99.9%) 7021,049 ops/ms [Average]
(min, avg, max) = (748532,416, 752155,256, 754155,985), stdev = 2503,774
CI (99.9%): [745134,207, 759176,305] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchEventNew
# Run progress: 77,78% complete, ETA 00:03:11
# Fork: 1 of 1
# Warmup Iteration 1: 158175,270 ops/ms
# Warmup Iteration 2: 161150,715 ops/ms
# Warmup Iteration 3: 169532,609 ops/ms
# Warmup Iteration 4: 169584,501 ops/ms
# Warmup Iteration 5: 169597,404 ops/ms
Iteration 1: 169537,438 ops/ms
Iteration 2: 169637,411 ops/ms
Iteration 3: 169598,859 ops/ms
Iteration 4: 169632,203 ops/ms
Iteration 5: 169719,587 ops/ms
Iteration 6: 169615,615 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchEventNew":
169623,519 ±(99.9%) 166,267 ops/ms [Average]
(min, avg, max) = (169537,438, 169623,519, 169719,587), stdev = 59,292
CI (99.9%): [169457,252, 169789,785] (assumes normal distribution)
# JMH version: 1.32
# VM version: JDK 16.0.1, OpenJDK 64-Bit Server VM, 16.0.1+9
# VM invoker: C:\Program Files\AdoptOpenJDK\jdk-16.0.1.9-hotspot\bin\java.exe
# VM options: -javaagent:C:\Program Files\JetBrains\IntelliJ IDEA\lib\idea_rt.jar=49551:C:\Program Files\JetBrains\IntelliJ IDEA\bin -Dfile.encoding=UTF-8
# Blackhole mode: full + dont-inline hint
# Warmup: 5 iterations, 4 s each
# Measurement: 6 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: net.md_5.bungee.event.SpeedTest.benchNew
# Run progress: 88,89% complete, ETA 00:01:35
# Fork: 1 of 1
# Warmup Iteration 1: 288196,266 ops/ms
# Warmup Iteration 2: 292523,149 ops/ms
# Warmup Iteration 3: 391369,608 ops/ms
# Warmup Iteration 4: 391130,962 ops/ms
# Warmup Iteration 5: 391388,005 ops/ms
Iteration 1: 391410,653 ops/ms
Iteration 2: 391493,600 ops/ms
Iteration 3: 391076,936 ops/ms
Iteration 4: 391266,695 ops/ms
Iteration 5: 391447,367 ops/ms
Iteration 6: 391245,723 ops/ms
Result "net.md_5.bungee.event.SpeedTest.benchNew":
391323,496 ±(99.9%) 437,925 ops/ms [Average]
(min, avg, max) = (391076,936, 391323,496, 391493,600), stdev = 156,168
CI (99.9%): [390885,571, 391761,421] (assumes normal distribution)
# Run complete. Total time: 00:14:23
REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
experiments, perform baseline and negative tests that provide experimental control, make sure
the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
Do not assume the numbers tell you what you want them to tell.
Benchmark Mode Cnt Score Error Units
SpeedTest.bench2Event thrpt 6 161322,551 ± 424,899 ops/ms
SpeedTest.bench2Event2 thrpt 6 163908,712 ± 366,460 ops/ms
SpeedTest.bench2Event3 thrpt 6 84655,500 ± 228,741 ops/ms
SpeedTest.bench2Event_ thrpt 6 162947,301 ± 119,321 ops/ms
SpeedTest.benchBlackhole thrpt 6 193382,220 ± 1528,584 ops/ms
SpeedTest.benchEvent thrpt 6 721905,842 ± 2497,878 ops/ms
SpeedTest.benchEvent2 thrpt 6 752155,256 ± 7021,049 ops/ms
SpeedTest.benchEventNew thrpt 6 169623,519 ± 166,267 ops/ms
SpeedTest.benchNew thrpt 6 391323,496 ± 437,925 ops/ms
Process finished with exit code 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment