Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <IniFiles>
- #define TESTS 50
- main()
- {
- file_OS();
- new tick;
- tick=GetTickCount();
- for(new i;i<TESTS;i++)
- {
- file_Open("Test.ini");
- file_SetStr("testing_key_for_strings", "this is a piece of text that is written to the file, you will probably want to read it again at some point!");
- file_Save("Test.ini");
- file_Close();
- }
- printf("Takes %d ms to Write Strings "#TESTS" times\n", GetTickCount()-tick);
- tick=GetTickCount();
- for(new i;i<TESTS;i++)
- {
- file_Open("Test.ini");
- file_SetVal("testing_key_for_integers", 47285);
- file_Save("Test.ini");
- file_Close();
- }
- printf("Takes %d ms to Write Integers "#TESTS" times\n", GetTickCount()-tick);
- //
- tick=GetTickCount();
- for(new i;i<TESTS;i++)
- {
- file_Open("Test.ini");
- file_SetFloat("testing_key_for_floats", 47285);
- file_Save("Test.ini");
- file_Close();
- }
- printf("Takes %d ms to Write Floats "#TESTS" times\n", GetTickCount()-tick);
- //
- tick=GetTickCount();
- for(new i;i<TESTS;i++)
- {
- new var_str[256];
- file_Open("Test.ini");
- strcat(var_str, file_GetStr("testing_key_for_strings"));
- file_Close();
- }
- printf("Takes %d ms to read strings "#TESTS" times\n", GetTickCount()-tick);
- //
- tick=GetTickCount();
- for(new i;i<TESTS;i++)
- {
- new var_int;
- file_Open("Test.ini");
- var_int=file_GetVal("testing_key_for_integers");
- file_Close();
- }
- printf("Takes %d ms to read integers "#TESTS" times\n", GetTickCount()-tick);
- //
- tick=GetTickCount();
- for(new i;i<TESTS;i++)
- {
- new var_flt;
- file_Open("Test.ini");
- var_flt=file_GetVal("testing_key_for_floats");
- file_Close();
- }
- printf("Takes %d ms to read floats "#TESTS" times\n", GetTickCount()-tick);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement