Use YAML (Responsibly)

[QUOTE="Orendigo, post: 14472, member: 1257"]So, I was curious about the subject, so I ran a few test to gather data.[/QUOTE]

So I posted this in a thread a while ago, and I felt it needs a bigger audience, so I'll post it here.

So, I was curious about the subject, so I ran a few test to gather data. My findings were pretty much what I expected after reading Rezz's Don't Use Yaml post.

Using the script provided in the post mentioned, I gathered data; here are my findings:

YAML vs. Skript Variable Setting (Unmodified Script)

YAML vs. Skript Variable (Unmodified Script)

*Amount if time: in seconds; not ticks!

Data (Unmodified Script)

I decided to see if using an SQlite database would change anything; it did not, so I decided not to include it in the graphs.

While it makes sense for Skript's Setting Data to slightly increase (but never strays too far from 1 second), Skript's Getting Data seems to be skewed. This is because of the "Pause" feature used in the testing script, which prevents the server from crashing during YAML getting/setting with large values.

The values themselves are skewed, the smaller elements increments only give a better visualization as to how skewed; however, this data skewness is necessary, as without it, gathering this data would crash the server.

To get a better insight on how the data is being skewed, I decided to remove the "pause" buffer in order to get better values, knowing full-well that my server crash after a point- and it did:

Data (Modified Script)

I was only able to get to 100 Elements without the YAML data being skewed. I believe better numbers can be achieved using the $ thread expression to prevent crashing, but further testing would need to be done. While these numbers provide interesting insight, I will not be using these values to draw a conclusion, as they are incomplete.

For setting data, the difference in efficiency starts to become ever so slightly apparent near the 100 elements mark, and is further amplified with 250 elements and beyond, as the YAML time is nearly +50% of Skript Variables time. When it comes to getting data, the difference is rather similar; the difference in efficiency becomes notable between the 100 elements mark, and the 250 elements mark.

With current addons, YAML data seems to increase exponentially (which supports Rezz's claim of addons needing to read every value). In addition, Skript's Variables are pretty darn efficient, which makes sense.

However, I do not believe this "local ban of YAML until someone makes an efficient addon" mentality is necessary. I'm not saying YAML is the full way to go- if you use it responsibly, you shouldn't see a problem.

Things you can probably use YAML for without noticing a significant difference in data storage timings:
  • Setting data that doesn't change often (or at all)
  • Getting specific values from config files (either script configs, or plugin configs)
  • Not making giant list of random values in a consecutive manner

Are we able to create/modify json files yet? Is that a thing?