Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- //#define SECURE_MEMORY_PLUGIN
- #include <memory>
- #define MEM_SIZE (1024)
- #define LOOP (100000)
- public OnFilterScriptInit()
- {
- print("\n==================================");
- print("= Memory access plugin benchmark =");
- print("==================================\n");
- new Pointer:ptr = MEM_malloc(MEM_SIZE), i, j, k, a, b, dummy;
- if(ptr)
- {
- for(i = 0; i < 5; i++)
- {
- a = GetTickCount();
- for(j = 0; j < LOOP; j++) for(k = 0; k < MEM_SIZE; k++) MEM_set_val(ptr, k, j);
- b = GetTickCount();
- printf("MEM_set_val() test: %dms", b-a);
- a = GetTickCount();
- for(j = 0; j < LOOP; j++) for(k = 0; k < MEM_SIZE; k++) dummy = MEM_get_val(ptr, k);
- #pragma unused dummy
- b = GetTickCount();
- printf("MEM_get_val() test: %dms", b-a);
- }
- MEM_free(ptr);
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement