BigETI

some benchmark script

Apr 29th, 2013
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.21 KB | None | 0 0
  1. #include <a_samp>
  2. #include <b_io> // http://pastebin.com/HhZmT4JV
  3.  
  4. new const my_array[100] = {1, ...};
  5.  
  6. public OnFilterScriptInit()
  7. {
  8.     print("\n====================");
  9.     print("= Some test script =");
  10.     print("=      Loaded      =");
  11.     print("====================\n");
  12.     if(fexist("some_test_file.bin")) fremove("some_test_file.bin");
  13.     new a = GetTickCount(), b, BFile:file_handle = BIO::open("some_test_file.bin", b_io_mode_write);
  14.     if(file_handle)
  15.     {
  16.         for(new i = 0; i < 100000; i++) BIO::write_8_arr(file_handle, my_array);
  17.         BIO::close(file_handle);
  18.     }
  19.     b = GetTickCount();
  20.     printf("BIO::write_8_arr took %d ms.", b-a);
  21.     fremove("some_test_file.bin");
  22.     a = GetTickCount();
  23.     new File:file_handle_2 = fopen("some_test_file.bin", io_write);
  24.     if(file_handle_2)
  25.     {
  26.         for(new i = 0; i < 100000; i++) for(new j = 0; j < sizeof my_array; j++) fputchar(file_handle_2, my_array[j], false);
  27.         //fblockwrite(file_handle_2, my_array);//
  28.         fclose(file_handle_2);
  29.     }
  30.     b = GetTickCount();
  31.     printf("fputchar took %d ms.", b-a);
  32.     return 1;
  33. }
  34.  
  35. public OnFilterScriptExit()
  36. {
  37.     print("\n====================");
  38.     print("= Some test script =");
  39.     print("=     Unloaded     =");
  40.     print("====================\n");
  41.     return 1;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment