18.11.2012, 11:01
Quote:
@[J]ulian
lol. WRONG TEST. EACH BENCHMARK SHOULD BE DONE SEPARATELY. like me. After Ternary benchmark, CPU/RAM get involved. as i said WRONG TEST. |
pawn Код:
#define LOOPS (1000000)
public OnFilterScriptInit()
{
new tmp = 0;
new time = GetTickCount();
for(new i = 0; i < LOOPS; ++i)
{
if(i > -1) {
tmp = 1;
}
else {
tmp = 2;
}
}
printf("if else time == %dms", GetTickCount()-time);
time = GetTickCount();//reset time
for(new i = 0; i < LOOPS; ++i)
{
tmp = (i > -1)? 1:2;
}
printf("ternary time == %dms", GetTickCount()-time);
return 1;
}
Код:
[12:19:41] if else time == 273ms [12:19:42] ternary time == 266ms
EDIT: Result are also more or less identical when benched separately too (even smaller difference (3ms) for me).