-
-
Save tr7zw/35bf270286e18167e76f508d0b158db5 to your computer and use it in GitHub Desktop.
PDC tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NBTGet implements Benchmark { | |
@Override | |
public String getName() { | |
return "NBTGet"; | |
} | |
@Override | |
public int run(ItemStack stack) { | |
return NBT.get(stack, nbt -> { | |
return nbt.getCompound("PublicBukkitValues").getInteger("nbtapibenchmark:test"); | |
}); | |
} | |
} | |
public class PDCGet implements Benchmark { | |
@Override | |
public String getName() { | |
return "PDCGet"; | |
} | |
@Override | |
public int run(ItemStack stack) { | |
ItemMeta meta = stack.getItemMeta(); | |
return meta.getPersistentDataContainer().get(new NamespacedKey(BenchmarkPlugin.INSTANCE, "test"), PersistentDataType.INTEGER); | |
} | |
} | |
public class PDCGetCachedKey implements Benchmark { | |
private final NamespacedKey key = new NamespacedKey(BenchmarkPlugin.INSTANCE, "test"); | |
@Override | |
public String getName() { | |
return "PDCCachedGet"; | |
} | |
@Override | |
public int run(ItemStack stack) { | |
ItemMeta meta = stack.getItemMeta(); | |
return meta.getPersistentDataContainer().get(key, PersistentDataType.INTEGER); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment