Advertisement
Southclaw

Structured vs Direct file requests

Sep 26th, 2011
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.68 KB | None | 0 0
  1. #include <a_samp>
  2. #include <IniFiles>
  3.  
  4. #define TESTFILE "testdata.ini"
  5. #define TESTS 100
  6.  
  7. main()
  8. {
  9.     file_OS();
  10.    
  11.     print("- Creating Files");
  12.     file_Create(TESTFILE);
  13.     file_Open(TESTFILE);
  14.     file_SetStr("TestKey", "Value");
  15.     file_Save(TESTFILE);
  16.     file_Close();
  17.     new tick, var[256];
  18.    
  19.     print("- Starting Test");
  20.    
  21.     tick=GetTickCount();
  22.     for(new i;i<TESTS;i++)
  23.     {
  24.         file_Open(TESTFILE);
  25.         var = file_GetStr("TestKey");
  26.         file_Close();
  27.     }
  28.     printf("Structured: %d - str: '%s'", GetTickCount()-tick, var);
  29.    
  30.  
  31.     tick=GetTickCount();
  32.     for(new i;i<TESTS;i++)
  33.     {
  34.         var = file_dGetStr(TESTFILE, "TestKey");
  35.     }
  36.     printf("Direct: %d - str: '%s'", GetTickCount()-tick, var);
  37.  
  38.    
  39. }
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement