Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main()
- {
- new
- test[] = #Bonjour,
- t = GetTickCount();
- for(new i; i < 100000000; i++)
- strlen_papawy(test);
- printf("strlen_papawy : %d ('%s' comporte %d caracteres)", GetTickCount()-t, test, strlen_papawy(test));
- t = GetTickCount();
- for(new i; i < 100000000; i++)
- strlen_satek(test);
- printf("strlen_satek : %d ('%s' comporte %d caracteres)", GetTickCount()-t, test, strlen_satek(test));
- t = GetTickCount();
- for(new i; i < 100000000; i++)
- strlen_dth(test);
- printf("strlen_dth : %d ('%s' comporte %d caracteres)", GetTickCount()-t, test, strlen_dth(test));
- t = GetTickCount();
- for(new i; i < 100000000; i++)
- strlen_dth2(test);
- printf("strlen_dth2 : %d ('%s' comporte %d caracteres)", GetTickCount()-t, test, strlen_dth2(test));
- t = GetTickCount();
- for(new i; i < 100000000; i++)
- strlen_dth3(test);
- printf("strlen_dth3 : %d ('%s' comporte %d caracteres)", GetTickCount()-t, test, strlen_dth3(test));
- }
- strlen_papawy(str[], size=sizeof(str))
- {
- new i;
- for(i=0; i<size;++i)
- {
- if(str[i] == EOS)
- break;
- }
- return i;
- }
- strlen_satek(const str[])
- {
- new idx;
- while(str[idx++] != EOS) {}
- return idx;
- }
- strlen_dth(const string[])
- {
- new
- c;
- for(;;c++)
- if(string[c] == EOS)
- break;
- return c;
- }
- strlen_dth2(const string[])
- {
- new
- i;
- while(string[i] != EOS) i++;
- return i;
- }
- strlen_dth3(const string[])
- {
- new
- c;
- for(; string[c] != EOS ; c++) {}
- return c;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement