Y_Less

ini comparisons

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