01.05.2012, 19:00
Thank you.
Test it, please:
Test it, please:
pawn Код:
#include a_samp
#define START_BENCH(%0); {new __a=%0,__b=0,__c,__d=GetTickCount(),__e=1;do{}\
while(__d==GetTickCount());__c=GetTickCount();__d= __c;while(__c-__d<__a||\
__e){if(__e){if(__c-__d>=__a){__e=0;__c=GetTickCount();do{}while(__c==\
GetTickCount());__c=GetTickCount();__d=__c;__b=0;} }{
#define FINISH_BENCH(%0); }__b++;__c=GetTickCount();}printf(" Bench for "\
%0": executes, by average, %.2f times/ms.",floatdiv(__b,__a));}
main()
{
new f = 0;
new t = 1;
START_BENCH(1000);
if(t && f) {}
if(f && t) {}
FINISH_BENCH("2");
START_BENCH(1000);
if(t) if(f) {}
if(f) if(t) {}
FINISH_BENCH("1");
}
/*
[16:11:55] Bench for 2: executes, by average, 3445.79 times/ms.
[16:11:57] Bench for 1: executes, by average, 4688.54 times/ms.
*/