Advertisement
BigETI

Writing an array 1 mio times into a file

Apr 28th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.90 KB | None | 0 0
  1. #include <a_samp>
  2. #include <b_io> // http://pastebin.com/HhZmT4JV
  3.  
  4. new const my_array[1000] = {0xFFFFFFFF, ...};
  5.  
  6. public OnFilterScriptInit()
  7. {
  8.     print("\n====================");
  9.     print("= Some test script =");
  10.     print("=      Loaded      =");
  11.     print("====================\n");
  12.     new a = GetTickCount(), b, BFile:file_handle = BIO::open("some_test_file.bin", b_io_mode_new);
  13.     if(file_handle)
  14.     {
  15.         for(new i = 0; i < 1000000; i++) BIO::write_32_arr(file_handle, my_array); // <- Writing 1 mio times a huge array into a file ( 4 x 1000 x 1000000 =  4000000000 Bytes! Around 3.73 GB)
  16.         BIO::close(file_handle);
  17.     }
  18.     b = GetTickCount();
  19.     printf("The process took %d ms.", b-a); // It took me about 109 seconds
  20.     return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25.     print("\n====================");
  26.     print("= Some test script =");
  27.     print("=     Unloaded     =");
  28.     print("====================\n");
  29.     return 1;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement