Advertisement
Guest User

Double-O-Files 2 comparison update

a guest
May 7th, 2011
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.19 KB | None | 0 0
  1. #include <Double-O-Files>
  2. #include <Double-O-Files_2>
  3. #include <Dini>
  4. #include <djson>
  5. #include <mxINI>
  6. #include <Fini>
  7. #include <cini>
  8. #include <YSI/y_ini>
  9. #include <SII>
  10.  
  11. //READ
  12. //READ
  13. //READ
  14. //READ
  15. //READ
  16. //READ
  17. //READ
  18. //READ
  19. //READ
  20. //READ
  21. //READ
  22. //READ
  23. //READ
  24. //READ
  25. //READ
  26. //READ
  27. //READ
  28. /*
  29. Buffer size in
  30.     Double-O-Files 1 & 2,
  31.     SII,
  32.     & Fini
  33. have to be set to 1000 or higher or not everything will be written.
  34.  
  35. INI_ in SII has to be renamed to SII_INI_ because of collisions with Y_INI.
  36.  
  37. */
  38. //READ
  39. //READ
  40. //READ
  41. //READ
  42. //READ
  43. //READ
  44. //READ
  45. //READ
  46. //READ
  47. //READ
  48. //READ
  49.  
  50.  
  51. #define MAX 1000
  52.  
  53. main () { }
  54. public OnGameModeInit()
  55. {
  56.     djson_GameModeInit();
  57.     new k;
  58.     new seed = GetTickCount ();
  59.     while(k<50)
  60.     {
  61.         printf("\nFileID=%d (%d entries)",k,MAX);
  62.         new t,file[64],string[64];
  63.        
  64.         new
  65.             INI:yini,
  66.             mxini,
  67.             val;
  68.        
  69.         print("-=-=-=-=-=-=-=-=-=-=-=-");
  70.        
  71.         //Double-O-Files
  72.         t=GetTickCount();
  73.         format(file,sizeof(file),"DOFfile%03d_%d.ini",k,seed);
  74.         DOF_CreateFile(file);
  75.         for(new i=0;i<MAX;i++)
  76.         {
  77.             format(string,sizeof(string),"IntVal%05d",i);
  78.             DOF_SetInt(file,string,random(1000));
  79.         }
  80.         DOF_SaveFile ();
  81.         DOF_SetFile ("");
  82.         printf("DOF SET: t=%d",GetTickCount()-t);
  83.  
  84.         //Double-O-Files 2
  85.         t=GetTickCount();
  86.         format(file,sizeof(file),"DOF2file%03d_%d.ini",k,seed);
  87.         DOF2.CreateFile(file);
  88.         for(new i=0;i<MAX;i++)
  89.         {
  90.             format(string,sizeof(string),"IntVal%05d",i);
  91.             DOF2.SetInt(file,string,random(1000));
  92.         }
  93.         DOF2.WriteFile ();
  94.         DOF2.SetFile ("");
  95.         printf("DOF2 SET: t=%d",GetTickCount()-t);
  96.        
  97.         //y_ini
  98.         t=GetTickCount();
  99.         format(file,sizeof(file),"YINIfile%03d_%d.ini",k,seed);
  100.         yini = INI_Open(file);
  101.         for(new i=0;i<MAX;i++)
  102.         {
  103.             format(string,sizeof(string),"IntVal%05d",i);
  104.             INI_WriteInt(yini, string, random(1000) );
  105.         }
  106.         INI_Close(yini);
  107.         printf("YINI SET: t=%d",GetTickCount()-t);
  108.        
  109.         //SII
  110.         t=GetTickCount();
  111.         format(file,sizeof(file),"SIIfile%03d_%d.ini",k,seed);
  112.         SII_INI_Open (file);
  113.         for(new i=0;i<MAX;i++)
  114.         {
  115.             format(string,sizeof(string),"IntVal%05d",i);
  116.             SII_INI_WriteInt(string, random(1000) );
  117.         }
  118.         SII_INI_Save ();
  119.         SII_INI_Close ();
  120.         printf("SII SET: t=%d",GetTickCount()-t);
  121.        
  122.         //mxINI
  123.         t=GetTickCount();
  124.         format(file,sizeof(file),"MXINIfile%03d_%d.ini",k,seed);
  125.         mxini = ini_createFile (file);
  126.         if (mxini < 0)
  127.             mxini = ini_openFile (file);
  128.         for(new i=0;i<MAX;i++)
  129.         {
  130.             format(string,sizeof(string),"IntVal%05d",i);
  131.             ini_setInteger (mxini, string, random (1000));
  132.         }
  133.         ini_closeFile (mxini);
  134.         printf("MXINI SET: t=%d",GetTickCount()-t);
  135.  
  136.         //cini
  137.         t=GetTickCount();
  138.         format(file,sizeof(file),"CINIfile%03d_%d.ini",k,seed);
  139.         cini_Create (file);
  140.         for(new i=0;i<MAX;i++)
  141.         {
  142.             format(string,sizeof(string),"IntVal%05d",i);
  143.             cini_FSave (file, "d", string, random (1000));
  144.         }
  145.         printf("CINI SET: t=%d",GetTickCount()-t);
  146.        
  147.         //Fini
  148.         t=GetTickCount();
  149.         format(file,sizeof(file),"FINIfile%03d_%d.ini",k,seed);
  150.         Fini_Create (file);
  151.         Fini_OpenFile (file);
  152.         for(new i=0;i<MAX;i++)
  153.         {
  154.             format(string,sizeof(string),"IntVal%05d",i);
  155.             Fini_SetVal (string, random (1000));
  156.         }
  157.         Fini_SaveFile (file);
  158.         Fini_CloseFile ();
  159.         printf("FINI SET: t=%d",GetTickCount()-t);
  160.  
  161.         //Dini
  162.         t=GetTickCount();
  163.         format(file,sizeof(file),"DINIfile%03d_%d.ini",k,seed);
  164.         dini_Create(file);
  165.         for(new i=0;i<MAX;i++)
  166.         {
  167.             format(string,sizeof(string),"IntVal%05d",i);
  168.             dini_IntSet(file,string,random(1000));
  169.         }
  170.         printf("DINI SET: t=%d",GetTickCount()-t);
  171.  
  172.         //DJSON
  173.         t=GetTickCount();
  174.         format(file,sizeof(file),"DJSONfile%03d_%d.ini",k,seed);
  175.         djCreateFile(file);
  176.         djAutocommit(false);
  177.         for(new i=0;i<MAX;i++)
  178.         {
  179.             format(string,sizeof(string),"Test/IntVal%05d",i);
  180.             djSetInt(file,string,random(1000));
  181.         }
  182.         djCommit(file);
  183.         djAutocommit(true);
  184.         printf("DJSON SET: t=%d",GetTickCount()-t);
  185.        
  186.         /*
  187.             GET GET GET GET GET
  188.         */
  189.  
  190.         print("-=-=-=-=-=-=-=-=-=-=-=-");
  191.  
  192.         //Double-O-Files
  193.         t=GetTickCount();
  194.         format(file,sizeof(file),"DOFfile%03d_%d.ini",k,seed);
  195.         for(new i=0;i<MAX;i++)
  196.         {
  197.             format(string,sizeof(string),"IntVal%05d",i);
  198.             DOF_GetInt(file,string);
  199.         }
  200.         printf("DOF GET: t=%d",GetTickCount()-t);
  201.        
  202.         //Double-O-Files 2
  203.         t=GetTickCount();
  204.         format(file,sizeof(file),"DOF2file%03d_%d.ini",k,seed);
  205.         for(new i=0;i<MAX;i++)
  206.         {
  207.             format(string,sizeof(string),"IntVal%05d",i);
  208.             DOF2.GetInt(file,string);
  209.         }
  210.         //DOF2.ParseFile (file, 0, true); // Loop or this.
  211.         printf("DOF2 GET: t=%d",GetTickCount()-t);
  212.        
  213.         //y_ini
  214.         t=GetTickCount();
  215.         format(file,sizeof(file),"YINIfile%03d_%d.ini",k,seed);
  216.         INI_ParseFile(file, string); // That's how Y_INI works? Loading everything in one function, isn't it?
  217.         /*
  218.         for(new i=0;i<1000;i++)
  219.         {
  220.             format(string,sizeof(string),"IntVal%05d",i);
  221.         }
  222.         */
  223.         printf("Y_INI GET: t=%d",GetTickCount()-t);
  224.        
  225.         t=GetTickCount();
  226.         format(file,sizeof(file),"SIIfile%03d_%d.ini",k,seed);
  227.         SII_INI_Open (file);
  228.         for(new i=0;i<MAX;i++)
  229.         {
  230.             format(string,sizeof(string),"IntVal%05d",i);
  231.             SII_INI_ReadInt (string);
  232.         }
  233.         SII_INI_Save ();
  234.         SII_INI_Close ();
  235.         printf("SII SET: t=%d",GetTickCount()-t);
  236.        
  237.         //mxINI
  238.         t=GetTickCount();
  239.         format(file,sizeof(file),"MXINIfile%03d_%d.ini",k,seed);
  240.         mxini = ini_createFile (file);
  241.         if (mxini < 0)
  242.             mxini = ini_openFile (file);
  243.         for(new i=0;i<MAX;i++)
  244.         {
  245.             format(string,sizeof(string),"IntVal%05d",i);
  246.             ini_getInteger (mxini, string, val);
  247.         }
  248.         ini_closeFile (mxini);
  249.         printf("MXINI GET: t=%d",GetTickCount()-t);
  250.        
  251.         //cini
  252.         t=GetTickCount();
  253.         format(file,sizeof(file),"CINIfile%03d_%d.ini",k,seed);
  254.         cini_Create (file);
  255.         for(new i=0;i<MAX;i++)
  256.         {
  257.             format(string,sizeof(string),"IntVal%05d",i);
  258.             cini_FLoad (file, "d", string, val);
  259.         }
  260.         printf("CINI GET: t=%d",GetTickCount()-t);
  261.        
  262.         //Fini
  263.         t=GetTickCount();
  264.         format(file,sizeof(file),"FINIfile%03d_%d.ini",k,seed);
  265.         Fini_OpenFile (file);
  266.         for(new i=0;i<MAX;i++)
  267.         {
  268.             format(string,sizeof(string),"IntVal%05d",i);
  269.             val = Fini_GetValue (string);
  270.         }
  271.         Fini_SaveFile (file);
  272.         Fini_CloseFile ();
  273.         printf("FINI GET: t=%d",GetTickCount()-t);
  274.  
  275.         //Dini
  276.         t=GetTickCount();
  277.         format(file,sizeof(file),"DINIfile%03d_%d.ini",k,seed);
  278.         for(new i=0;i<MAX;i++)
  279.         {
  280.             format(string,sizeof(string),"IntVal%05d",i);
  281.             dini_Int(file,string);
  282.         }
  283.         printf("DINI GET: t=%d",GetTickCount()-t);
  284.  
  285.         //DJSON
  286.         t=GetTickCount();
  287.         format(file,sizeof(file),"DJSONfile%03d_%d.ini",k,seed);
  288.         for(new i=0;i<MAX;i++)
  289.         {
  290.             format(string,sizeof(string),"Test/IntVal%05d",i);
  291.             djInt(file,string);
  292.         }
  293.         printf("DJSON GET: t=%d",GetTickCount()-t);
  294.         k++;
  295.        
  296.         print("-=-=-=-=-=-=-=-=-=-=-=-");
  297.         print(" ");
  298.     }
  299.     return 1;
  300. }
  301.  
  302. public OnFilterScriptExit()
  303. {
  304.     DOF_Exit();
  305.     DOF2.Exit ();
  306.     djson_GameModeExit();
  307.     return 1;
  308. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement