Y_Less

ini comparisons

Sep 14th, 2010
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.33 KB | None | 0 0
  1. #include <YSI\y_ini>
  2.  
  3. #include <Dini>
  4.  
  5. #include <SII>
  6.  
  7. #include <Double-O-Files>
  8.  
  9. INI:core[ysi_properties](name[], value[])
  10. {
  11. }
  12.  
  13. INI:core[ysi_help](name[], value[])
  14. {
  15. }
  16.  
  17. INI:core[](name[], value[])
  18. {
  19.     printf("Name: \"%s\"", name);
  20.     printf("Value: \"%s\"", value);
  21.     printf("====");
  22. }
  23.  
  24. INI:testing[](name[], value[])
  25. {
  26. //  printf("Name: \"%s\"", name);
  27. //  printf("Value: \"%s\"", value);
  28. //  printf("====");
  29. }
  30.  
  31. INI:testing[woo](name[], value[])
  32. {
  33. //  printf("Name: \"%s\"", name);
  34. //  printf("Value: \"%s\"", value);
  35.     printf("%s = %s", name, value);
  36. //  printf("====");
  37. }
  38.  
  39. new
  40.     gStr[64];
  41.  
  42. forward myload(name[], value[]);
  43. public myload(name[], value[])
  44. {
  45.     if (!strcmp(name, "EG1_KILL_HELP"))
  46.     {
  47.         strcpy(gStr, value, 64);
  48.         return;
  49.     }
  50.     if (!strcmp(name, "EG1_DROP_HELP_1"))
  51.     {
  52.         strcpy(gStr, value, 64);
  53.         return;
  54.     }
  55.     if (!strcmp(name, "EG1_DROP_SPLAT"))
  56.     {
  57.         strcpy(gStr, value, 64);
  58.         return;
  59.     }
  60.     if (!strcmp(name, "EG1_KILL_HELP"))
  61.     {
  62.         strcpy(gStr, value, 64);
  63.         return;
  64.     }
  65. }
  66.  
  67. main()
  68. {
  69.     print("\n----------------------------------");
  70.     print(" Blank Gamemode by your name here");
  71.     print("----------------------------------\n");
  72.     //INI_Load("YSI/core.EN");
  73.     //printf("%d", !strcmp("", "hi"));
  74. /*  INI_Load("testing.ini");
  75.     new
  76.         INI:tt = INI_Open("testing.ini");*/
  77.     /*INI_WriteString(tt, "fa", "aa");
  78.     INI_WriteString(tt, "fb", "aa");
  79.     INI_WriteString(tt, "fc", "aa");
  80.     INI_WriteString(tt, "fd", "aa");*/
  81.     /*INI_SetTag(tt, "woo");
  82.     INI_WriteString(tt, "fa", "ca1");
  83.     INI_WriteString(tt, "fb", "ca1");
  84.     INI_WriteString(tt, "fc", "ca1");
  85.     INI_WriteString(tt, "fd", "ca1");
  86.     INI_RemoveEntry(tt, "fb");
  87.     INI_Close(tt);
  88.     INI_Load("testing.ini");*/
  89. //  _INI_dini("eg1.EN");
  90.     /*printf("%s", _INI_diniGetOne("eg1.EN", "EG1_KILL_HELP"));
  91.     printf("%s", _INI_diniGetOne("eg1.EN", "EG1_DROP_HELP_1"));
  92.     printf("%s", _INI_diniGetOne("eg1.EN", "EG1_DROP_SPLAT"));
  93.     printf("%s", _INI_diniGetOne("eg1.EN", "EG1_KILL_HELP"));*/
  94. //  printf("%s", GetVehicleNameFromID(10));
  95.     new t0 = GetTickCount();
  96.     for (new i = 0; i != 100000; ++i)
  97.     {
  98.         strcpy(gStr, _INI_diniGetOne("eg1.EN", "EG1_KILL_HELP"), 64);
  99.         strcpy(gStr, _INI_diniGetOne("eg1.EN", "EG1_DROP_HELP_1"), 64);
  100.         strcpy(gStr, _INI_diniGetOne("eg1.EN", "EG1_DROP_SPLAT"), 64);
  101.         strcpy(gStr, _INI_diniGetOne("eg1.EN", "EG1_KILL_HELP"), 64);
  102.     }
  103. //  print(gStr);
  104.     new t1 = GetTickCount();
  105.     for (new i = 0; i != 100000; ++i)
  106.     {
  107.         _INI_Close(INI:0);
  108.         strcpy(gStr, _INI_diniGetOne("eg1.EN", "EG1_KILL_HELP"), 64);
  109.         strcpy(gStr, _INI_diniGetOne("eg1.EN", "EG1_DROP_HELP_1"), 64);
  110.         strcpy(gStr, _INI_diniGetOne("eg1.EN", "EG1_DROP_SPLAT"), 64);
  111.         strcpy(gStr, _INI_diniGetOne("eg1.EN", "EG1_KILL_HELP"), 64);
  112.     }
  113. //  print(gStr);
  114.     new t2 = GetTickCount();
  115.     for (new i = 0; i != 100000; ++i)
  116.     {
  117.         strcpy(gStr, dini_Get("eg1.EN", "EG1_KILL_HELP"), 64);
  118.         strcpy(gStr, dini_Get("eg1.EN", "EG1_DROP_HELP_1"), 64);
  119.         strcpy(gStr, dini_Get("eg1.EN", "EG1_DROP_SPLAT"), 64);
  120.         strcpy(gStr, dini_Get("eg1.EN", "EG1_KILL_HELP"), 64);
  121.     }
  122. //  print(gStr);
  123.     new t3 = GetTickCount();
  124.     for (new i = 0; i != 100000; ++i)
  125.     {
  126.         _INI_ParseFile("eg1.EN", "myload", .eTagless = e_ini_tags_none);
  127.     }
  128. //  print(gStr);
  129.     new t4 = GetTickCount();
  130.     for (new i = 0; i != 100000; ++i)
  131.     {
  132.         SINI_Open("eg1.EN");
  133.         SINI_ReadString(gStr, "EG1_KILL_HELP");
  134.         SINI_ReadString(gStr, "EG1_DROP_HELP_1");
  135.         SINI_ReadString(gStr, "EG1_DROP_SPLAT");
  136.         SINI_ReadString(gStr, "EG1_KILL_HELP");
  137.         SINI_Close();
  138.     }
  139. //  print(gStr);
  140.     new t5 = GetTickCount();
  141.     for (new i = 0; i != 100000; ++i)
  142.     {
  143.         // To simulate large times between reads.
  144.         DOF_SetFile("-");
  145.         strcpy(gStr, DOF_GetString("eg1.EN", "EG1_KILL_HELP"), 64);
  146.         strcpy(gStr, DOF_GetString("eg1.EN", "EG1_DROP_HELP_1"), 64);
  147.         strcpy(gStr, DOF_GetString("eg1.EN", "EG1_DROP_SPLAT"), 64);
  148.         strcpy(gStr, DOF_GetString("eg1.EN", "EG1_KILL_HELP"), 64);
  149.     }
  150.     new t6 = GetTickCount();
  151.     for (new i = 0; i != 100000; ++i)
  152.     {
  153.         // To simulate data still held in buffer.
  154.         strcpy(gStr, DOF_GetString("eg1.EN", "EG1_KILL_HELP"), 64);
  155.         strcpy(gStr, DOF_GetString("eg1.EN", "EG1_DROP_HELP_1"), 64);
  156.         strcpy(gStr, DOF_GetString("eg1.EN", "EG1_DROP_SPLAT"), 64);
  157.         strcpy(gStr, DOF_GetString("eg1.EN", "EG1_KILL_HELP"), 64);
  158.     }
  159.     new t7 = GetTickCount();
  160.     printf("%d %d %d %d %d %d %d", t1 - t0, t2 - t1, t3 - t2, t4 - t3, t5 - t4, t6 - t5, t7 - t6);
  161. }
Advertisement
Add Comment
Please, Sign In to add comment