SpigotMC / BungeeCord

BungeeCord, the 6th in a generation of server portal suites. Efficiently proxies and maintains connections and transport between multiple Minecraft servers.
https://www.spigotmc.org/go/bungeecord
Other
1.57k stars 1.1k forks source link

Code optimization suggestions #3308

Open noobyu6 opened 2 years ago

noobyu6 commented 2 years ago

Hi,

I find that the private field serverModList and serverIdList at Line 37 in the file 'BungeeCord/proxy/src/main/java/net/md_5/bungee/forge/ForgeClientHandler.java' on the master branch is only assigned and used in the method setServerIdList and setServerModList. Therefore, these fields can be removed from the class, and become local variables in the method setServerIdList and setServerModList. This transformation will normally reduce memory usage and improve readability of your code.I will be happy if this transformation is helpful.

Janmm14 commented 2 years ago

Since nearly nobody these days will have forge support enabled in bungee as modern forge is not supported by bungee at all, this optimization will not provide nearly no practical benefits, but in general you're correct.