BlueTree242 / AdvancedPlHide

A plugin that allows you to remove parts of tab completion and hide plugins from the tabcompleter!
GNU General Public License v3.0
9 stars 4 forks source link

Reduce Plugin Weight #7

Closed ReferTV closed 2 years ago

ReferTV commented 2 years ago

I recommend separating the file for each server engine, i.e. make some jars adventedplhide-spigot, adventedplhide-bungee, adventedplhide-velocity. This would slightly reduce the weight of the plugin and the plugin would not load unnecessary code. In general, I recommend that you somehow reduce the weight of this plugin because it weighs a lot .

BlueTree242 commented 2 years ago

The jars are already generated, i just only publish the universal one

BlueTree242 commented 2 years ago

I don't think it would reduce at all, we shade a library that is needed for each server engine

A248 commented 2 years ago

It doesn't save you performance to remove unused classes from a jar -- i.e., there is no "load unnecessary code." The JVM loads classes as needed. So, if the plugin jar contains classes which are never loaded, those classes won't hurt performance.

The "weight of a plugin" is somewhat misleading, because as I just mentioned, the JVM loads classes as needed. You really shouldn't worry if a plugin jar is 500 KB or 3 MB. What matters from a performance perspective is the code that is run, not the code which can run.

In general, it is a common myth that a larger plugin jar necessarily means the plugin is "heavier' and thus has an impact on performance. At most, a larger plugin jar uses more storage space. That's it, that's all, and that's all you would ever have to worry about.

BlueTree242 commented 2 years ago

Yes, i still need to find a way to fix this, jar is big due to shade of okhttp, which is kotlin made and shading kotlin is required, so the solution for this issue is to find a smaller http library

A248 commented 2 years ago

Why not use the JDK's java.net.http library? It is available since Java 11, and AdvancedPlHide already requires Java 11 according to the build.gradle.

BlueTree242 commented 2 years ago

My bad, the java version is overriden in the modules' build.gradle, for example spigot and core compiled with java 9

BlueTree242 commented 2 years ago

at first i was gonna require java 11 but 1.8 servers don't run on java 11 (atleast for me it didn't start) so i reduced java version for spigot and only velocity classes compiled with java 11, the version in main build.gradle is supposed to be default, but spigot compiled java 9

BlueTree242 commented 2 years ago

Tell me if you know small sized http library that support java 9+

A248 commented 2 years ago

I don't think there's any reason to support Java 9 and Java 10. No one uses those versions -- either for Minecraft or for the rest of the Java ecosystem -- because they are unsupported and end-of-life. Java 9 and 10 stopped receiving security updates 4 years ago.

Java 8 and Java 11 are LTS. If you require Java 9, you might as well require Java 11. The difference is very slim.

BlueTree242 commented 2 years ago

Alright you are right about that, i will fix jar weight and java version soon

BlueTree242 commented 2 years ago

Perfect, jar weight reduced now its 740kb (less than 1mb), java 11 is now required for every server engine, you can download the dev build here, this will be released soon