mirror of https://github.com/Minestom/Minestom.git
Also in TagWriteBenchmark
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
07bebd6bc8
commit
4bc1dca602
|
@ -19,6 +19,7 @@ public class TagWriteBenchmark {
|
|||
TagHandler tagHandler;
|
||||
Tag<String> secondTag;
|
||||
|
||||
MutableNBTCompound concurrentCompound;
|
||||
MutableNBTCompound compound;
|
||||
|
||||
@Setup
|
||||
|
@ -27,7 +28,10 @@ public class TagWriteBenchmark {
|
|||
this.tagHandler = TagHandler.newHandler();
|
||||
tagHandler.setTag(TAG, "value");
|
||||
secondTag = Tag.String("key");
|
||||
// NBT benchmark
|
||||
// Concurrent map benchmark
|
||||
this.concurrentCompound = new MutableNBTCompound(new ConcurrentHashMap<>());
|
||||
concurrentCompound.set("key", NBT.String("value"));
|
||||
// Hash map benchmark
|
||||
this.compound = new MutableNBTCompound(new ConcurrentHashMap<>());
|
||||
compound.set("key", NBT.String("value"));
|
||||
}
|
||||
|
@ -48,7 +52,12 @@ public class TagWriteBenchmark {
|
|||
}
|
||||
|
||||
@Benchmark
|
||||
public void writeConstantTagFromCompound() {
|
||||
public void writeConcurrentCompound() {
|
||||
concurrentCompound.setString("key", "value");
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void writeCompound() {
|
||||
compound.setString("key", "value");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue