SA-MP Forums Archive
Optimizing my Scripts - 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: Optimizing my Scripts (/showthread.php?tid=598207)



Optimizing my Scripts - BiosMarcel - 09.01.2016

Hello,

I'd like to ask if anyone here knows whats faste?

this:
PHP код:
format(string,sizeof(string),"test"); 
or is this:
PHP код:
string "test"
I'd like to know that, i know it isn't that important but i really want to know this.

greetings Marcel


Re: Optimizing my Scripts - ikey07 - 09.01.2016

second method, format should be used ONLY if you intend to use %s etcetra


Re: Optimizing my Scripts - Vince - 09.01.2016

In any case it's not format. Format is the absolute slowest way to copy strings. If you can, use direct assignment (your second example). If that's not possible use memcpy or strcpy.


Re: Optimizing my Scripts - BiosMarcel - 09.01.2016

Okay thanks, i thought so but just to be sure i thought i should ask