Optimizing my Scripts
#1

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
Reply
#2

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

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.
Reply
#4

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


Forum Jump:


Users browsing this thread: 2 Guest(s)