Fastest String Loop
#13

I ran few tests and if the length is long, these two made a difference:

This is the fastest:
pawn Код:
for(j = strlen(string); --j != -1;)
and second comes:
pawn Код:
for(j = strlen(string); j != 0; j --)
http://pastebin.com/raw/AdJuRncr

Results:
pawn Код:
Bench for 1st: executes, by average, 168.35 times/ms.
Bench for 2nd: executes, by average, 156.76 times/ms.
Bench for 3rd: executes, by average, 173.58 times/ms.
Bench for 4th: executes, by average, 168.80 times/ms.
Bench for 5th: executes, by average, 171.69 times/ms.
Bench for 6th: executes, by average, 149.65 times/ms.
Bench for 7th: executes, by average, 174.24 times/ms.
Bench for 8th: executes, by average, 223.66 times/ms.
Bench for 9th: executes, by average, 174.86 times/ms.
Bench for 10th: executes, by average, 174.98 times/ms.
Bench for 11th: executes, by average, 217.67 times/ms.
EDIT: I removed the part I was setting the text in the loops and did few more. The result for longer strings are the same but for 1 or 2 characters only, this becomes the fastest:
pawn Код:
for(j = 0; string[j]; j ++)
Reply


Messages In This Thread
Fastest String Loop - by SickAttack - 11.10.2016, 03:03
Re: Fastest String Loop - by SyS - 11.10.2016, 03:48
Re: Fastest String Loop - by SickAttack - 11.10.2016, 04:57
Re: Fastest String Loop - by Gammix - 11.10.2016, 05:55
Re: Fastest String Loop - by Yashas - 11.10.2016, 07:09
Re: Fastest String Loop - by SyS - 11.10.2016, 07:54
Re: Fastest String Loop - by SickAttack - 11.10.2016, 14:56
Re: Fastest String Loop - by Luicy. - 11.10.2016, 15:16
Re: Fastest String Loop - by SyS - 11.10.2016, 15:18
Re: Fastest String Loop - by SickAttack - 11.10.2016, 15:27
Re: Fastest String Loop - by Jayse - 11.10.2016, 16:22
Re: Fastest String Loop - by Stinged - 11.10.2016, 18:18
Re: Fastest String Loop - by Konstantinos - 11.10.2016, 18:42

Forum Jump:


Users browsing this thread: 1 Guest(s)