Advertisement
Johurt

speed test

Mar 28th, 2016
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.24 KB | None | 0 0
  1. main()
  2. {
  3.     for(new a; a < 5; a++) testA();
  4. }
  5.  
  6. enum eoxoA
  7. {
  8.     participant[2]
  9. }
  10. new oxoA[MAX_PLAYERS / 2][eoxoA];
  11.  
  12. enum pItem
  13. {
  14.     oxoID
  15. }
  16. new pInfo[MAX_PLAYERS][pItem];
  17.  
  18. stock testA()
  19. {
  20.     new gt, c, playerid = 20;
  21.     gt = GetTickCount();
  22.     for(c = 0; c < 10000000; c++)
  23.     {
  24.         new id, oxo_id;
  25.         oxo_id = pInfo[playerid][oxoID];
  26.         if(oxoA[oxo_id][participant][0] == playerid)
  27.         {
  28.             id = oxoA[oxo_id][participant][1];
  29.         }
  30.         else
  31.         {
  32.             id = oxoA[oxo_id][participant][0];
  33.         }
  34.         SetPlayerHealth(id, 100.0);
  35.     }
  36.     printf("1. %dMS" , GetTickCount() - gt);
  37.     gt = GetTickCount();
  38.     for(c = 0; c < 10000000; c++)
  39.     {
  40.         new id = oxoA[pInfo[playerid][oxoID]][participant][0] == playerid ? 1 : 0;
  41.         SetPlayerHealth(oxoA[pInfo[playerid][oxoID]][participant][id], 100.0);
  42.     }
  43.     printf("2. %dMS" , GetTickCount() - gt);
  44.     gt = GetTickCount();
  45.     for(c = 0; c < 10000000; c++)
  46.     {
  47.         SetPlayerHealth(oxoA[pInfo[playerid][oxoID]][participant][0] == playerid ? oxoA[pInfo[playerid][oxoID]][participant][1] : oxoA[pInfo[playerid][oxoID]][participant][0], 100.0);
  48.     }
  49.     printf("3. %dMS" , GetTickCount() - gt);
  50. }
  51.  
  52. /*
  53.     1. 1922MS, 1936MS, 1944MS, 1952MS, 2006MS
  54.     2. 1984MS, 1987MS, 1995MS, 1976MS, 2028MS
  55.     3. 1995MS, 1998MS, 1999MS, 2000MS 2100MS
  56. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement