Optimization
#7

There are lots of things you can do to optimize your script.
Use switch instead of if...else
Quote:

if(reason == 0) { raison = "Coup de Poing."; }
else if(reason == 1) { raison = "Poing Amйricain"; }
else if(reason == 2) { raison = "Club de Golf"; }
else if(reason == 3)

And here
Quote:

if(hittype==BULLET_HIT_PETROL_TANK)// Quand on tire sur le reservoir d'essence
{

and lots of other places where you have RHS constants.

Use >> and << for division and multiplication of numbers by powers of 2.
number & (divisor - 1) for powers of 2 will give the remainder - this is faster!
Use static and avoid useless initializations of variables in functions.

Some places where you have used format can be done using strcat easily which is faster.

Use proper arrays with proper size.You are wasting so many cells.Why do you need to make a string 256 cells big when the max input/output limit of client message is 128?

Refer these links:
https://sampforum.blast.hk/showthread.php?tid=216730
https://sampforum.blast.hk/showthread.php?tid=57018
Reply


Messages In This Thread
Optimization - by anou1 - 13.02.2014, 11:27
Re: Optimization - by ACI - 13.02.2014, 11:33
Re: Optimization - by venomlivno8 - 13.02.2014, 11:35
Re: Optimization - by anou1 - 13.02.2014, 14:32
Re: Optimization - by Tamer - 13.02.2014, 15:25
Re: Optimization - by anou1 - 13.02.2014, 15:35
Re: Optimization - by Yashas - 13.02.2014, 16:35
Re: Optimization - by anou1 - 13.02.2014, 18:10
Re: Optimization - by Tamer - 13.02.2014, 18:21
Re: Optimization - by Yashas - 13.02.2014, 18:29

Forum Jump:


Users browsing this thread: 2 Guest(s)