Home / Help / Fr 🇫🇷 | En 🇬🇧 / The minificaytion (Optimisation)

The minificaytion (Optimisation)

Servers suffer a lot from loads when there are a lot of scripts, users take a long time to reach a server and sometimes get discouraged before the end of the load and leave, reducing this time could prevent them from leaving before the end of the load by reducing it as much as possible, this method applied to all your scripts is not to be neglected.

In programming, minification means to reduce the size of the code to reduce the size of a program to download from a server and thus reduce network congestion, on Gmod the size of a Lua file on the client side if it is minified it will be faster to download. There are a lot of optimization rules, minimization is one of them.

To do this, we remove all unnecessary comments and characters that will not interfere with the proper functioning of the application. The name of the application's internal variables is also replaced to reduce them to one or two characters. It is also possible to use some compact writings specific to the languages (color in hexadecimal, shortcuts...).
This process is widely used in web programming.

Exemple 1: Code not minified
Code not minified
local function my_supermegahyper_test ( Player , Argument , NUMBER )

local firstnumber = NUMBER[1] ;
return firstnumber * 2;
concommand.Add( "give_me_double" , my_supermegahyper_test )

Exemple 2: Code minified
Code minified
local function test(a,b,c)return c[1]*2 end


Applying minification to an entire program gives a result that is not negligible.
This method is used to reduce the downloading time in many languages, when you work in a team it is important to take stock so you don't get lost in the limbo of minification.