Quote:
Originally Posted by [MM]RoXoR[FS]
I did a speed comparision, using this code
pawn Код:
main() { new str[2048],f; for(new i = 0;i<2048;++i) str[i] = random(90-65)+65; new stime,ftime,loc; stime = GetTickCount(); for(new i=0;i<10000000;++i) { f=random(90-65)+65; loc = strfind1(str,f); } ftime = GetTickCount(); printf("strfind1 took %d ",ftime-stime); stime = GetTickCount(); for(new i=0;i<10000000;++i) { f=random(90-65)+65; loc = strfind1(str,f); } ftime = GetTickCount(); printf("strfind took %d ",ftime-stime);
}
Results were pretty same.
Код:
[15:55:34] strfind1 took 28715
[15:56:03] strfind took 28718
So it would be useless only to use mine strfind seeing very little difference.
|
You used strfind1 twice.. lol..
Also, yours doesn't work properly. It returns 1 if found at 0, etc. It should return -1 if not found, 0 if at 0, 1 if at 1, etc..