Closed Olyno closed 1 year ago
Users don't really know how to benchmark properly so that information has little to no use to us or the users, it'll just incentive people making flawed benchmarks to come here and complain about how slow an expression/effect takes. I personally don't like the idea.
Indeed people could trash talk about the speed of Skript. BUT, it's a good opportinity to improve it and improve the global code of Skript (like if an effect is really slow, how make it faster). With a benchmark, we can see all progress we do (What was the result before? What is the current? Is it better? Why isn't better? ...) Plus, a benchmark is a good opportunity to show that Skript isn't slow and make a great job.
Here is the benchmark I did:
command benchmark:
trigger:
set {_initialValue} to 0
set {_setTime} to now
loop 5000000 times:
set {_initialValue} to {_initialValue} + 1
set {_setTime} to difference between {_setTime} and now
set {_addTime} to now
loop 5000000 times:
add 1 to {_initialValue}
set {_addTime} to difference between {_addTime} and now
set {_removeTime} to now
loop 5000000 times:
remove 1 from {_initialValue}
set {_removeTime} to difference between {_removeTime} and now
broadcast "&bSet 5 000 000 times: %{_setTime}%"
broadcast "&aAdd 5 000 000 times: %{_addTime}%"
broadcast "&cRemove 5 000 000 times: %{_removeTime}%"
And here is the result I got:
Skript clearly has nothing to be ashamed of with this result, it's a very good result!
Creating a benchark allows both to test the speed of the parser (and thus to keep the parser fast) BUT ALSO to locate possible bugs. Example: Skript is very fast with paper spigot 1.13 but is very slow with 1.15, this means there is something wrong with it.
Anyway, I think in my personal opinion that doing a benchmark can only be beneficial to the project.
A better benchmark was created by @KingAlterIV, thanks to him: https://gist.github.com/KingAlterIV/d1c069b51ca683510391241093e3d5b7
Try this with skript-db ^^ it's fun in async mode
Personally not a fan of this either, I mean... this sorta falls under the users-side.
Putting Skript into debug mode details times, and lots of information. Check your config.sk. It will also make addons error that don't properly handle debug messages.
There is skript timings?
Profiler has been added.
Description
Sometimes I'm asking myself how long or fast is Skript's parser, or simply syntaxes things like inventories. Maybe adding a benchmark system could be a benefit like a no regression test.