11.10.2016, 03:03
(
Последний раз редактировалось SickAttack; 11.10.2016 в 14:54.
)
I posted this thread as most people create their loops that go through strings as follows:
for(new j = 0, k = strlen(string); j < k; j ++)
Which ended up in 3rd.
----------------------------------------------------
***** 1,000,000 ITERATIONS *****
// ** Lowest: 2,666 ms | Highest: 2,724 ms
// ** Lowest: 2,648 ms | Highest: 2,700 ms
// ** Lowest: 2,619 ms | Highest: 2,686 ms
// ** Lowest: 2,536 ms | Highest: 2,599 ms
// ** Lowest: 1,428 ms | Highest: 1,450 ms
// ** Lowest: 1,422 ms | Highest: 1,440 ms
// ** Lowest: 1,320 ms | Highest: 1,351 ms
// ** Lowest: 1,314 ms | Highest: 1,349 ms
// ** Lowest: 1,309 ms | Highest: 1,319 ms
// ** Lowest: 1,299 ms | Highest: 1,324 ms
// ** Lowest: 1,193 ms | Highest: 1,225 ms
for(new j = 0, k = strlen(string); j < k; j ++)
Which ended up in 3rd.
----------------------------------------------------
***** 1,000,000 ITERATIONS *****
// ** Lowest: 2,666 ms | Highest: 2,724 ms
Код:
new j = (strlen(string) - 1); while(j != -1) { j --; }
Код:
new j, k = strlen(string); while(j != k) { j ++; }
Код:
new j = -1; while(string[++ j])
Код:
new j = strlen(string); do { j --; } while(j != 0);
Код:
for(j = 0; string[j]; j ++)
Код:
for(new j = 0; string[j] != EOS; j ++)
Код:
for(new j = (strlen(string) - 1); j > -1; j --)
Код:
for(new j = strlen(string); --j != -1;)
Код:
for(new j = 0, k = strlen(string); j < k; j ++)
Код:
for(new j = 0, k = strlen(string); j != k; j ++)
Код:
for(new j = strlen(string); j != 0; j --) { // printf("%d", j - 1); }