Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- public OnFilterScriptInit()
- {
- print(" ");
- new time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_OK(str);
- }
- printf("OKStyle - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_MellikJKE(str);
- }
- printf("MellikJKE - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_regnaR(str);
- }
- printf("regnaR - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_DC(str);
- }
- printf("Daniel_Cortez - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_Denwer(str);
- }
- printf("Denwer - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_VT(str);
- }
- printf("Valera_Trefilov - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_ziggi(str);
- }
- printf("ziggi - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_g3o0or(str);
- }
- printf("g3o0or - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_polander(str);
- }
- printf("polander - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_Untonyst(str);
- }
- printf("Untonyst - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_polander(str);
- }
- printf("polander - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_iBorland(str);
- }
- printf("iBorland - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_Tracer(str);
- }
- printf("Tracer - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_ProG(str);
- }
- printf("ProG - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_KD(str);
- }
- printf("Kenny_Dalglish - %d мс", GetTickCount() - time);
- time = GetTickCount();
- for(new i = 0; i < 100000; i++)
- {
- new str[] = " любая строка для теста ";
- RemoveSpaces_ZL(str);
- }
- printf("Zaur_Lumanov - %d мс", GetTickCount() - time);
- print(" ");
- // Old Test
- /*
- new str[] = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_OK(str);
- printf("OKStyle - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_MellikJKE(str);
- printf("MellikJKE - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_regnaR(str);
- printf("regnaR - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_DC(str);
- printf("Daniel_Cortez - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_Denwer(str);
- printf("Denwer - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_VT(str);
- printf("Valera_Trefilov - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_ziggi(str);
- printf("ziggi - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_g3o0or(str);
- printf("g3o0or - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_polander(str);
- printf("polander - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_Untonyst(str);
- printf("Untonyst - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_iBorland(str);
- printf("iBorland - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_Tracer(str);
- printf("Tracer - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_ProG(str);
- printf("ProG - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_KD(str);
- printf("Kenny_Dalglish - %d мс (%s)", GetTickCount() - time, str);
- str = " любая строка для теста ";
- time = GetTickCount();
- for(new i = 0; i < 100000; i++) RemoveSpaces_ZL(str);
- printf("Zaur_Lumanov - %d мс (%s)", GetTickCount() - time, str);
- */
- }
- stock RemoveSpaces_OK(string[])
- {
- for(new i = strlen(string) - 1; i != -1; i--) if(string[i] == 32) strdel(string, i, i + 1);
- }
- stock RemoveSpaces_MellikJKE(String[])
- {
- new i;
- static ii;
- for(ii = 0; String[ii] != '\0'; ii++)
- {
- switch(String[ii])
- {
- case ' ': continue;
- default: String[i++] = String[ii];
- }
- }
- String[i] = '\0';
- }
- stock RemoveSpaces_regnaR(string[])
- {
- new i = strlen(string);
- while( i >= 0 )
- {
- if(string[i] == ' ')
- {
- for(new j = i; j < strlen(string); j++)
- {
- string[j] = string[j+1];
- }
- }
- i--;
- }
- }
- stock RemoveSpaces_DC(string[])
- {
- static pos, pos2, c;
- for (pos = 0, pos2 = 0;; ++pos)
- {
- c = string[pos];
- switch (c)
- {
- case ' ': continue;
- case '\0': break;
- }
- string[pos2++] = c;
- }
- string[pos2] = '\0';
- }
- stock RemoveSpaces_Denwer(string[])
- {
- for( new i = 0x0; string[i] != 0x0; ++i ) if( string[i] == 0x20 ) strdel(string, i, i+1);
- }
- stock RemoveSpaces_VT(string[])
- {
- for(new i=0; strfind(string," ") != -1; i++) strdel(string,strfind(string," "),strfind(string," ")+1);
- }
- stock RemoveSpaces_ziggi(string[])
- {
- for (new i = 0, start = -1; string[i] != '\0'; i++) {
- if (string[i] == ' ') {
- if (start == -1) {
- start = i;
- }
- } else {
- if (start != -1) {
- strdel(string, start, i);
- i -= start + 2;
- start = -1;
- }
- }
- }
- }
- stock RemoveSpaces_g3o0or(string[])
- {
- new write_pos;
- for(new read_pos; string[read_pos] != '\0'; read_pos++)
- {
- if(string[read_pos] == ' ')
- {
- continue;
- }
- else
- {
- string[write_pos++] = string[read_pos];
- }
- }
- string[write_pos] = '\0';
- }
- stock RemoveSpaces_polander(string[])
- {
- new pos = strfind(string, " ");
- while(pos != -1)
- {
- strdel(string, pos, pos+1);
- pos = strfind(string, " ");
- }
- }
- stock RemoveSpaces_Untonyst(string[])
- {
- for(new i; string[i] != '\0'; i++)
- if(string[i] == ' ')
- strdel(string, i, i + 1), --i;
- }
- stock RemoveSpaces_iBorland(string[])
- {
- for(new i = 0; strfind(string," ") != -1; i++)
- {
- strdel(string, strfind(string," "), strfind(string," ") + 1);
- }
- }
- stock RemoveSpaces_Tracer(string[])
- {
- for(new i, l = strlen(string); i < l; ++i)
- {
- if(string[i] != 32)continue;
- strdel(string, i, i+1);
- }
- }
- stock RemoveSpaces_ProG(string[])
- {
- for( new i = 0; string[i]; )
- {
- if(string[i] == ' ') strdel(string, i, i + 1);
- else i++;
- }
- }
- stock RemoveSpaces_KD(input[])
- {
- new pos, DelSymbol = ' ';
- for(pos = strlen(input); input[pos] <= DelSymbol; ) pos--;
- input[pos + 1] = EOS;
- for(pos = 0; input[pos] <= DelSymbol; ) pos++;
- strdel(input, 0, pos);
- }
- stock RemoveSpaces_ZL(string[])
- {
- new i, sp, buf[128];
- strcat(buf, string);
- for(i = 0; buf[i]; i++)
- {
- if (buf[i] == ' ') sp++;
- else string[i-sp] = buf[i];
- }
- string[i-sp] = '\0';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement