mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-13 19:51:27 +01:00
clear remaining hephaistos usage
This commit is contained in:
parent
8f46913486
commit
65f75bb059
@ -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<String> secondTag;
|
||||
|
||||
MutableNBTCompound concurrentCompound;
|
||||
MutableNBTCompound compound;
|
||||
Map<String, String> map;
|
||||
Map<String, String> 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"));
|
||||
}
|
||||
}
|
||||
|
@ -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<String> secondTag;
|
||||
|
||||
MutableNBTCompound concurrentCompound;
|
||||
MutableNBTCompound compound;
|
||||
Map<String, String> map;
|
||||
Map<String, String> 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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user