From 267c9ba967684a87f386b7abe2438e8c871fe491 Mon Sep 17 00:00:00 2001 From: Peridot Date: Mon, 1 Apr 2024 17:40:25 +0200 Subject: [PATCH] Update benchmarks --- .../inject/InstanceConstructionBenchmark.java | 22 +++++++++++-------- ...stanceConstructionWithFieldsBenchmark.java | 18 ++++++++------- .../inject/InvokeMethodBenchmark.java | 12 +++++----- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InstanceConstructionBenchmark.java b/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InstanceConstructionBenchmark.java index dc23aaa..6c1f337 100644 --- a/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InstanceConstructionBenchmark.java +++ b/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InstanceConstructionBenchmark.java @@ -11,20 +11,24 @@ import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; -/* JDK17 (I5-8600K OC 4.5 Ghz, 32GB RAM 3200Mhz, Windows 10) - Benchmark Mode Cnt Score Error Units - InstanceConstructionBenchmark.direct thrpt 10 1789904.378 � 1122.822 ops/ms - InstanceConstructionBenchmark.injected thrpt 10 2629.149 � 66.627 ops/ms - InstanceConstructionBenchmark.injectedFast thrpt 10 2890.650 � 35.665 ops/ms - InstanceConstructionBenchmark.injectedStatic thrpt 10 2681.387 � 3.025 ops/ms - InstanceConstructionBenchmark.injectedStaticFast thrpt 10 2890.723 � 8.385 ops/ms - InstanceConstructionBenchmark.reflection thrpt 10 104444.640 � 88.579 ops/ms +/* JDK17 (R9-5900X, 32GB RAM 3200Mhz, Windows 11) + Benchmark Mode Cnt Score Error Units + InstanceConstructionBenchmark.direct thrpt 10 8660370.966 � 104379.534 ops/ms + InstanceConstructionBenchmark.generatedInjected thrpt 10 13621.451 � 37.353 ops/ms + InstanceConstructionBenchmark.generatedInjectedStatic thrpt 10 14021.858 � 180.536 ops/ms + InstanceConstructionBenchmark.injected thrpt 10 8321.647 � 187.627 ops/ms + InstanceConstructionBenchmark.injectedFast thrpt 10 8941.758 � 263.119 ops/ms + InstanceConstructionBenchmark.injectedStatic thrpt 10 8742.619 � 370.675 ops/ms + InstanceConstructionBenchmark.injectedStaticFast thrpt 10 9668.630 � 376.711 ops/ms + InstanceConstructionBenchmark.reflection thrpt 10 193259.892 � 671.292 ops/ms */ @Fork(value = 1) @Warmup(iterations = 10, time = 2) @Measurement(iterations = 10, time = 2) +@Threads(4) @OutputTimeUnit(TimeUnit.MILLISECONDS) public class InstanceConstructionBenchmark { @@ -42,7 +46,7 @@ public Entity(int id, String name, EntityData data) { } - private static class EntityData { + public static class EntityData { private final int coins; private final float health; diff --git a/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InstanceConstructionWithFieldsBenchmark.java b/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InstanceConstructionWithFieldsBenchmark.java index d9a0069..56a2764 100644 --- a/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InstanceConstructionWithFieldsBenchmark.java +++ b/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InstanceConstructionWithFieldsBenchmark.java @@ -15,21 +15,23 @@ import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import org.panda_lang.utilities.inject.annotations.Inject; -/* JDK17 (I5-8600K OC 4.5 Ghz, 32GB RAM 3200Mhz, Windows 10) - Benchmark Mode Cnt Score Error Units - InstanceConstructionWithFieldsBenchmark.direct thrpt 10 1784219.469 � 7246.175 ops/ms - InstanceConstructionWithFieldsBenchmark.injected thrpt 10 1508.048 � 10.094 ops/ms - InstanceConstructionWithFieldsBenchmark.injectedFast thrpt 10 2540.255 � 11.664 ops/ms - InstanceConstructionWithFieldsBenchmark.injectedStatic thrpt 10 2139.461 � 15.704 ops/ms - InstanceConstructionWithFieldsBenchmark.injectedStaticFast thrpt 10 3807.769 � 19.776 ops/ms - InstanceConstructionWithFieldsBenchmark.reflection thrpt 10 21433.173 � 28.671 ops/ms +/* JDK17 (R9-5900X, 32GB RAM 3200Mhz, Windows 11) + Benchmark Mode Cnt Score Error Units + InstanceConstructionWithFieldsBenchmark.direct thrpt 10 8568409.473 � 56063.080 ops/ms + InstanceConstructionWithFieldsBenchmark.injected thrpt 10 8734.063 � 132.188 ops/ms + InstanceConstructionWithFieldsBenchmark.injectedFast thrpt 10 10741.429 � 337.507 ops/ms + InstanceConstructionWithFieldsBenchmark.injectedStatic thrpt 10 8002.083 � 540.164 ops/ms + InstanceConstructionWithFieldsBenchmark.injectedStaticFast thrpt 10 10337.340 � 404.279 ops/ms + InstanceConstructionWithFieldsBenchmark.reflection thrpt 10 28319.446 � 555.004 ops/ms */ @Fork(value = 1) @Warmup(iterations = 10, time = 2) @Measurement(iterations = 10, time = 2) +@Threads(4) @OutputTimeUnit(TimeUnit.MILLISECONDS) public class InstanceConstructionWithFieldsBenchmark { diff --git a/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InvokeMethodBenchmark.java b/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InvokeMethodBenchmark.java index 90b0394..645e573 100644 --- a/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InvokeMethodBenchmark.java +++ b/di-benchmarks/src/jmh/java/org/panda_lang/utilities/inject/InvokeMethodBenchmark.java @@ -26,19 +26,21 @@ import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import panda.utilities.ReflectionUtils; -/* JDK17 (I5-8600K OC 4.5 Ghz, 32GB RAM 3200Mhz, Windows 10) +/* JDK17 (R9-5900X, 32GB RAM 3200Mhz, Windows 11) Benchmark Mode Cnt Score Error Units - InvokeMethodBenchmark.direct thrpt 10 492235.407 � 988.297 ops/ms - InvokeMethodBenchmark.generatedInjected thrpt 10 432266.343 � 737.527 ops/ms - InvokeMethodBenchmark.injected thrpt 10 142187.855 � 502.770 ops/ms - InvokeMethodBenchmark.reflection thrpt 10 189730.282 � 22464.101 ops/ms + InvokeMethodBenchmark.direct thrpt 10 868064.094 � 2086.213 ops/ms + InvokeMethodBenchmark.generatedInjected thrpt 10 864293.983 � 13610.569 ops/ms + InvokeMethodBenchmark.injected thrpt 10 857157.778 � 22008.580 ops/ms + InvokeMethodBenchmark.reflection thrpt 10 434325.439 � 1554.849 ops/ms */ @Fork(value = 1) @Warmup(iterations = 10, time = 2) @Measurement(iterations = 10, time = 2) +@Threads(4) @OutputTimeUnit(TimeUnit.MILLISECONDS) public class InvokeMethodBenchmark {