Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- const Iterations = 10000;
- new fileline = 0;
- stock fdonothing() {
- return 1;
- }
- stock fdonothingr() {
- return (--fileline) >= 0;
- }
- stock File:fdonothingf() {
- fileline = Iterations;
- return File:1;
- }
- #define fopen(%0) fdonothingf()
- #define fclose(%0) fdonothing()
- #define fwrite(%0) fdonothing()
- #define fread(%0) fdonothingr()
- #define fremove(%0) fdonothing()
- #define fexist(%0) fdonothing()
- #include <dini>
- public OnFilterScriptInit() {
- SetTimer(#TestSpeed, 10000, false);
- return 1;
- }
- forward TestSpeed();
- public TestSpeed() {
- printf("Iterations = %i", Iterations);
- new start, end, str[128], File:f;
- start = GetTickCount();
- f = fopen("speedTest1.ini", io_write);
- for(new i=0; i<Iterations; ++i) {
- format(str, sizeof(str), "polozka%03i=%i\r\n", i, i);
- fwrite(f, str);
- }
- fclose(f);
- end = GetTickCount();
- printf("Test1 = %i", end - start);
- start = GetTickCount();
- dini_Create("speedTest3.ini");
- for(new i=0; i<Iterations; ++i) {
- format(str, sizeof(str), "polozka%03i", i, i);
- dini_IntSet("speedTest3.ini", str, i);
- }
- end = GetTickCount();
- printf("Test3 = %i", end - start);
- start = GetTickCount();
- for(new j=0; j<Iterations; ++j) {
- f = fopen("speedTest2.ini", io_write);
- for(new i=0; i<1000; ++i) {
- format(str, sizeof(str), "polozka%03i=%i\r\n", i, i);
- fwrite(f, str);
- }
- fclose(f);
- }
- end = GetTickCount();
- printf("Test2 = %i", end - start);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement