Advertisement
Guest User

test...

a guest
Jul 15th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7. #define START_BENCH(%0); {new __a=%0,__b=0,__c,__d=GetTickCount(),__e=1;do{}\
  8.     while(__d==GetTickCount());__c=GetTickCount();__d=__c;while(__c-__d<__a||\
  9.     __e){if(__e){if(__c-__d>=__a){__e=0;__c=GetTickCount();do{}while(__c==\
  10.     GetTickCount());__c=GetTickCount();__d=__c;__b=0;}}{
  11.  
  12. #define FINISH_BENCH(%0); }__b++;__c=GetTickCount();}printf(" Bench for "\
  13.     %0": executes, by average, %.2f times/ms.",floatdiv(__b,__a));}
  14. static stringformat[64],stringstrcat[64];
  15. public OnFilterScriptInit()
  16. {
  17.     START_BENCH(10000);
  18.     {
  19.     format(stringformat,sizeof(stringformat),"Hello");
  20.     format(stringformat,sizeof(stringformat),"%s World",stringformat);
  21.     }
  22.     FINISH_BENCH("stringformat");
  23.     START_BENCH(10000);
  24.     {
  25.     strcat(stringstrcat,"Hello ",sizeof(stringstrcat));
  26.     strcat(stringstrcat,"World",sizeof(stringstrcat));
  27.     }
  28.     FINISH_BENCH("stringstrcat");
  29.     printf("bench 1: %s,bench 2: %s",stringformat,stringstrcat);
  30. }
  31. public OnFilterScriptExit()
  32. {
  33.     return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement