mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-14 20:21:53 +01:00
clear remaining hephaistos usage
This commit is contained in:
parent
8f46913486
commit
65f75bb059
@ -1,11 +1,10 @@
|
|||||||
package net.minestom.server.tag;
|
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.annotations.*;
|
||||||
import org.openjdk.jmh.infra.Blackhole;
|
import org.openjdk.jmh.infra.Blackhole;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -24,8 +23,8 @@ public class TagReadBenchmark {
|
|||||||
TagHandler tagHandler;
|
TagHandler tagHandler;
|
||||||
Tag<String> secondTag;
|
Tag<String> secondTag;
|
||||||
|
|
||||||
MutableNBTCompound concurrentCompound;
|
Map<String, String> map;
|
||||||
MutableNBTCompound compound;
|
Map<String, String> concurrentMap;
|
||||||
|
|
||||||
@Setup
|
@Setup
|
||||||
public void setup() {
|
public void setup() {
|
||||||
@ -34,11 +33,11 @@ public class TagReadBenchmark {
|
|||||||
if (present) tagHandler.setTag(TAG, "value");
|
if (present) tagHandler.setTag(TAG, "value");
|
||||||
secondTag = Tag.String("key");
|
secondTag = Tag.String("key");
|
||||||
// Concurrent map benchmark
|
// Concurrent map benchmark
|
||||||
this.concurrentCompound = new MutableNBTCompound(new ConcurrentHashMap<>());
|
map = new HashMap<>();
|
||||||
if (present) concurrentCompound.set("key", NBT.String("value"));
|
if (present) map.put("key", "value");
|
||||||
// Hash map benchmark
|
// Hash map benchmark
|
||||||
this.compound = new MutableNBTCompound(new HashMap<>());
|
concurrentMap = new ConcurrentHashMap<>();
|
||||||
if (present) compound.set("key", NBT.String("value"));
|
if (present) concurrentMap.put("key", "value");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
@ -57,12 +56,12 @@ public class TagReadBenchmark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public void readConcurrentCompound(Blackhole blackhole) {
|
public void readConcurrentMap(Blackhole blackhole) {
|
||||||
blackhole.consume(concurrentCompound.getString("key"));
|
blackhole.consume(concurrentMap.get("key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public void readCompound(Blackhole blackhole) {
|
public void readMap(Blackhole blackhole) {
|
||||||
blackhole.consume(compound.getString("key"));
|
blackhole.consume(map.get("key"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package net.minestom.server.tag;
|
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.annotations.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -20,8 +19,8 @@ public class TagWriteBenchmark {
|
|||||||
TagHandler tagHandler;
|
TagHandler tagHandler;
|
||||||
Tag<String> secondTag;
|
Tag<String> secondTag;
|
||||||
|
|
||||||
MutableNBTCompound concurrentCompound;
|
Map<String, String> map;
|
||||||
MutableNBTCompound compound;
|
Map<String, String> concurrentMap;
|
||||||
|
|
||||||
@Setup
|
@Setup
|
||||||
public void setup() {
|
public void setup() {
|
||||||
@ -30,11 +29,11 @@ public class TagWriteBenchmark {
|
|||||||
tagHandler.setTag(TAG, "value");
|
tagHandler.setTag(TAG, "value");
|
||||||
secondTag = Tag.String("key");
|
secondTag = Tag.String("key");
|
||||||
// Concurrent map benchmark
|
// Concurrent map benchmark
|
||||||
this.concurrentCompound = new MutableNBTCompound(new ConcurrentHashMap<>());
|
map = new HashMap<>();
|
||||||
concurrentCompound.set("key", NBT.String("value"));
|
map.put("key", "value");
|
||||||
// Hash map benchmark
|
// Hash map benchmark
|
||||||
this.compound = new MutableNBTCompound(new HashMap<>());
|
concurrentMap = new ConcurrentHashMap<>();
|
||||||
compound.set("key", NBT.String("value"));
|
concurrentMap.put("key", "value");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
@ -53,12 +52,12 @@ public class TagWriteBenchmark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public void writeConcurrentCompound() {
|
public void writeConcurrentMap() {
|
||||||
concurrentCompound.setString("key", "value");
|
concurrentMap.put("key", "value");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Benchmark
|
@Benchmark
|
||||||
public void writeCompound() {
|
public void writeMap() {
|
||||||
compound.setString("key", "value");
|
map.put("key", "value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user