Advertisement
YashasSamaga

PAWN - Arrays are SLOWER than Individual Variables

Jul 4th, 2015
1,529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.06 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. main()
  4. {
  5.     for(new j = 0;j < 5;j++)
  6.     {
  7.         new a = GetTickCount();
  8.         for(new i = 0;i < 10000000;i++)
  9.         {
  10.             new x,y,z;
  11.             x = 12;
  12.             y = 12342;
  13.             z = 123123;
  14.             x = 12;
  15.             y = 12342;
  16.             z = 123123;
  17.             x = 12;
  18.             y = 12342;
  19.             z = 123123;
  20.             x = 12;
  21.             y = 12342;
  22.             z = 123123;
  23.             if(x == 0) {}
  24.             else if(y == 0) {}
  25.             else if(z == 0) {}
  26.             X(x,y,z);
  27.         }
  28.         new b = GetTickCount();
  29.         printf("Speed Test %d",b-a);
  30.        
  31.         a = GetTickCount();
  32.         for(new i = 0;i < 10000000;i++)
  33.         {
  34.             new arr[3];
  35.             arr[0] = 12;
  36.             arr[1] = 12342;
  37.             arr[2] = 123123;
  38.             arr[0] = 12;
  39.             arr[1] = 12342;
  40.             arr[2] = 123123;
  41.             arr[0] = 12;
  42.             arr[1] = 12342;
  43.             arr[2] = 123123;
  44.             arr[0] = 12;
  45.             arr[1] = 12342;
  46.             arr[2] = 123123;
  47.             if(arr[0] == 0) {}
  48.             else if(arr[1] == 0) {}
  49.             else if(arr[2] == 0) {}
  50.             X(arr[0],arr[1],arr[2]);
  51.         }
  52.         b = GetTickCount();
  53.         printf("Speed Test %d \n\n",b-a);
  54.     }
  55. }
  56. stock X(x,y,z) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement