Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #define system:: system_
- // Slice's benchmarking macros.
- #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));}
- public
- OnFilterScriptInit()
- {
- START_BENCH( 10000 );
- {
- system::strCheck("PLAYMAKER", "PLAYMAKER");
- }
- FINISH_BENCH( "system::strCheck" );
- START_BENCH( 10000 );
- {
- strcmp("PLAYMAKER", "PLAYMAKER");
- }
- FINISH_BENCH( "strcmp" );
- return true;
- }
- /*
- system::strCheck:
- Check if the strings ('s_' and '_s') match each other.
- Arguments:
- s_[] First string.
- _s[] Second string.
- Returns:
- ? False, True.
- Notes:
- Similar to strcmp, but faster.
- */
- stock
- system::strCheck(s_[], _s[])
- {
- new
- c = 0
- , bool:b = true
- ;
- while (max(strlen(s_), strlen(_s)) != c)
- {
- if (s_[c] != _s[c])
- {
- b
- = false
- ;
- }
- ++
- c
- ;
- }
- if (b)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement