What is faster? - 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: What is faster? (
/showthread.php?tid=614039)
What is faster? -
Whatname - 03.08.2016
Ok so I know switch is faster than if but is there something faster than switch?
Re: What is faster? -
Luicy. - 03.08.2016
Why would there?
No, switch are fastest and uses less cpu.
Re: What is faster? -
Whatname - 03.08.2016
Ok thx
Re: What is faster? -
PrO.GameR - 03.08.2016
Switch is not "faster", it works different, it works with constants, while with if-else if you can check if two variables are same.
Learn how to use each the right way, and you don't need your code to be "faster" at all, everything would just work.
Re: What is faster? -
SickAttack - 03.08.2016
Quote:
Originally Posted by Meller
Why would there?
No, switch are fastest and uses less cpu.
|
Please learn when to use is and when to use are (as you don't listen to criticism and just get angry).
is = singular
are = plural
Quote:
Originally Posted by PrO.GameR
Switch is not "faster", it works different, it works with constants, while with if-else if you can check if two variables are same.
Learn how to use each the right way, and you don't need your code to be "faster" at all, everything would just work.
|
That's right, they execute in milliseconds either way.