SA-MP Forums Archive
How to reduce CPU ussage? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to reduce CPU ussage? (/showthread.php?tid=613058)



How to reduce CPU ussage? - CrazyPerry - 24.07.2016

I currently hosting my server in ultra-h.com and my server have 85% cpu ussage and it so LAG can you guys tell me how to reduce this thing?


Re: How to reduce CPU ussage? - BiosMarcel - 24.07.2016

Optimize your script or get a better server ...


Re: How to reduce CPU ussage? - Logic_ - 24.07.2016

Optimization includes...

Timer, using a lot of timers can cause lag
Variables, using a lot of variables takes place in memory, Ultra-H uses less memory that the minimum required for your gamemode, resulting lag.
Coding tips, optimization also include how you type the code, 'cause the code is being executed, if you have un-optimized then its going to slow down the process.

Example:
PHP код:
// UN-Optimized use of variables
new var1;
new 
var2;
new 
var3;
// Optimized use of variables
new var1var2var3;
// UN-Optimized use of variable (setting values)
var1 0;
var2 0;
var3 0;
// Optimized use of variables (setting values)
var1 var2 var3 0



Re: How to reduce CPU ussage? - CrazyPerry - 24.07.2016

thanks man i will try it