Tutorial by: Olyno


Skript's criminal record: skript-mirror case

Table of content

Many users see skript-mirror as a genius addon, but I'm not one of them. Skript-mirror should only be used in specific cases and not all over the place. Let me argue what I'm saying.

What is skript-mirror?

First of all, if you don't know skript-mirror, let me introduce it to you: it's a skript addon that allows you to use Java code in Skript. It also allows you to create custom syntax in Skript directly. Does it sound good to your ear ? It shouldn't.

What is Skript

Let me explain to you exactly what Skript is and how it works. This explanation will be useful later on. Skript is currently a Minecraft plugin to program from English. So it is based on the Java language and the Bukkit/Spigot api.
So in the end, what Skript does when it executes your code is:

1) Server (Bukkit/Spigot)
2) Java (the server uses Java to load the different plugins)
3) Skript (Skript is loaded, it's its turn to work)
4) Java (Skript also needs Java to load its addons)
5) Code (the code you execute via Skript)
6) Addon concerned (if there is the syntax of an addon, or a skript syntax used directly)
7) Java (Executes the code)

Well, if you followed these seven steps, let's see what skript-mirror does:

1) Server (Bukkit/Spigot)
2) Java (the server uses Java to load the different plugins)
3) Skript (Skript is loaded, it's its turn to work)
4) Java (Skript also needs Java to load its addons)
5) Code (the code you execute via Skript)
6) skript-mirror
7) Java (execute code)
8) Java (converts the code to Java)
9) Java (executes the converted code)

So skript-mirror is theoretically slower than other addons. Let's try to put that into practice to test our theory.

Skript Scoreboard Benchmark

Several addons allow us to make scoreboards. In our case, we will focus on the most recent addons (and of course skript-mirror). What I've done is change the title and line 1 of the scoreboard 5 times, and each time it generates a random code mutliplied by the loop in question.

Example:

loop 5 times:
    set {_code} to ""
    loop (5 * loop-value) times:
        set {_code} to "%{_code}%a"
    # change the title or the line with the new value

Then once I created the little code, I tested it on several addons: SkBee, Skore, SkRayFall and skript-mirror.

Note: for each test, I restarted the server to avoid a possible cache. I also averaged the results in order to obtain the final results.

How about Skellett?

His author created Skore which I guess is Skellett's successor for the scoreboards. So I made the choice to use Skore only.

The other addons haven't been updated for a long time and therefore don't participate in the test.

Here are the results of the benchmark (lower is better):

Time to refresh the title of the scoreboard:

Results available at https://i.imgur.com/Xlkz373.png if you don't see them

Time to refresh a line of the scoreboard:

Results available at https://i.imgur.com/6K6PjrL.png if you don't see them

Time to make the test:

Results available at https://i.imgur.com/yp2nmcm.png if you don't see them

Code of the benchmark I did available here

As we can see, skript-mirror is behind SkBee in terms of speed, but ahead of Skore.

Although now that I've debunked the myth that "skript-mirror is the fastest", we're going to be able to go on.

Why not use skript-mirror

There are several reasons not to use it all the time. The first one is that skript-mirror will never replace an addon coded by a developer. Very often when you are going to use skript-mirror, you are going to use Java methods that are not correct or even deprecated. When an addon developer codes his addon, he will think about many things, especially performance. Clearly you will save a lot of time using the addon in question that skript-mirror.

If you really want to use skript-mirror for a big thing, you should :

In which case should you use skript-mirror

As I said before, skript-mirror is only to be used at specific times. Here they are:

The small FAQ for users

I don't need 50 add-on plugins when I already have skript-mirror.

True, but that would be like overloading skript-mirror. It is worth noting that each addon has its own particularity (skript-yaml for yamls files, Skent for file management, Skore for scoreboards). Better to use an axe to cut down a tree than a little spoon, don't you think?

skript-mirror is much faster than this addon.

Okay, cool, so you didn't follow up on anything I said. Please go back to reading my paving stone.


Did you find Olyno's tutorial helpful?


You must be logged in to comment

  • April 10, 2022, 1:21 p.m. - oskark  

    This test is flawed, because when testing skript-mirror you haven't used the Spigot API, but the API of the TitleManager plugin. The result you've got for speed of skript-mirror is actually: (speed of skript-mirror) + (speed of TitleManager). So the result is useless regarding skript-mirror's speed, because it's more like comparing SkBee/Skore/SkRayFall to TitleManager plugin, therefore you can't claim that you proved that skript-mirror is slower than SkBee/Skore/SkRayFall.

    |