Skip to content

Performance Saver

Leonhard edited this page Oct 20, 2020 · 2 revisions

LightningStorage is designed to provide as best performance as possible. In normal use-cases, it can reach about 3x speed as the Bukkit/Bungee API can.

But LightningStorage also provides a lot of methods to further increase this performance if needed. So you can get every piece of performance from our FlatFile.

Yaml yaml = new Yaml("Name", "Path");

// Bad
yaml.set("Key-1", "Value-1");
yaml.set("Key-2", "Value-2");
yaml.set("Key-3", "Value-3");
// Good
yaml.getFileData().insert("Key-1", "Value-1");
yaml.getFileData().insert("Key-2", "Value-2");
yaml.set("Key-3", "Value-3");
// Benefit: File will only be written to once.

// Bad
yaml.remove("Key-1");
yaml.remove("Key-2");
yaml.remove("Key-3");
// Good
yaml.removeAll("Key-1", "Key-2", "Key-3");
// Benefit: File will only be written to once.
Clone this wiki locally