diff --git a/jmh-benchmarks/src/jmh/java/net/minestom/server/tag/TagReadBenchmark.java b/jmh-benchmarks/src/jmh/java/net/minestom/server/tag/TagReadBenchmark.java index fc3d5871c..b7a91fe09 100644 --- a/jmh-benchmarks/src/jmh/java/net/minestom/server/tag/TagReadBenchmark.java +++ b/jmh-benchmarks/src/jmh/java/net/minestom/server/tag/TagReadBenchmark.java @@ -1,11 +1,10 @@ package net.minestom.server.tag; -import org.jglrxavpok.hephaistos.nbt.NBT; -import org.jglrxavpok.hephaistos.nbt.mutable.MutableNBTCompound; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; import java.util.HashMap; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; @@ -24,8 +23,8 @@ public class TagReadBenchmark { TagHandler tagHandler; Tag secondTag; - MutableNBTCompound concurrentCompound; - MutableNBTCompound compound; + Map map; + Map concurrentMap; @Setup public void setup() { @@ -34,11 +33,11 @@ public class TagReadBenchmark { if (present) tagHandler.setTag(TAG, "value"); secondTag = Tag.String("key"); // Concurrent map benchmark - this.concurrentCompound = new MutableNBTCompound(new ConcurrentHashMap<>()); - if (present) concurrentCompound.set("key", NBT.String("value")); + map = new HashMap<>(); + if (present) map.put("key", "value"); // Hash map benchmark - this.compound = new MutableNBTCompound(new HashMap<>()); - if (present) compound.set("key", NBT.String("value")); + concurrentMap = new ConcurrentHashMap<>(); + if (present) concurrentMap.put("key", "value"); } @Benchmark @@ -57,12 +56,12 @@ public class TagReadBenchmark { } @Benchmark - public void readConcurrentCompound(Blackhole blackhole) { - blackhole.consume(concurrentCompound.getString("key")); + public void readConcurrentMap(Blackhole blackhole) { + blackhole.consume(concurrentMap.get("key")); } @Benchmark - public void readCompound(Blackhole blackhole) { - blackhole.consume(compound.getString("key")); + public void readMap(Blackhole blackhole) { + blackhole.consume(map.get("key")); } } diff --git a/jmh-benchmarks/src/jmh/java/net/minestom/server/tag/TagWriteBenchmark.java b/jmh-benchmarks/src/jmh/java/net/minestom/server/tag/TagWriteBenchmark.java index 4da4d4a06..182e7b387 100644 --- a/jmh-benchmarks/src/jmh/java/net/minestom/server/tag/TagWriteBenchmark.java +++ b/jmh-benchmarks/src/jmh/java/net/minestom/server/tag/TagWriteBenchmark.java @@ -1,10 +1,9 @@ package net.minestom.server.tag; -import org.jglrxavpok.hephaistos.nbt.NBT; -import org.jglrxavpok.hephaistos.nbt.mutable.MutableNBTCompound; import org.openjdk.jmh.annotations.*; import java.util.HashMap; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; @@ -20,8 +19,8 @@ public class TagWriteBenchmark { TagHandler tagHandler; Tag secondTag; - MutableNBTCompound concurrentCompound; - MutableNBTCompound compound; + Map map; + Map concurrentMap; @Setup public void setup() { @@ -30,11 +29,11 @@ public class TagWriteBenchmark { tagHandler.setTag(TAG, "value"); secondTag = Tag.String("key"); // Concurrent map benchmark - this.concurrentCompound = new MutableNBTCompound(new ConcurrentHashMap<>()); - concurrentCompound.set("key", NBT.String("value")); + map = new HashMap<>(); + map.put("key", "value"); // Hash map benchmark - this.compound = new MutableNBTCompound(new HashMap<>()); - compound.set("key", NBT.String("value")); + concurrentMap = new ConcurrentHashMap<>(); + concurrentMap.put("key", "value"); } @Benchmark @@ -53,12 +52,12 @@ public class TagWriteBenchmark { } @Benchmark - public void writeConcurrentCompound() { - concurrentCompound.setString("key", "value"); + public void writeConcurrentMap() { + concurrentMap.put("key", "value"); } @Benchmark - public void writeCompound() { - compound.setString("key", "value"); + public void writeMap() { + map.put("key", "value"); } }