Quote:
Originally Posted by $ЂЯĢ
Quote:
Originally Posted by Incognito
...
|
Hmm, haven't even thought that way, but it seems like a good solution.
----------------------------------------------------------------------
I made some tests now.
pawn Код:
COMMAND:test(playerid,params[]) { new tick = GetTickCount(); for(new i=0; i<100000; i++) { SetPVarInt(playerid,"RandomID",i); } printf("tick #1: %d",GetTickCount() - tick); tick = GetTickCount(); for(new i=0; i<100000; i++) { GetPVarInt(playerid,"RandomID"); } printf("tick #2: %d",GetTickCount() - tick); tick = GetTickCount(); for(new i=0; i<100000; i++) { SetGVarInt("RandomID",i); } printf("tick #3: %d",GetTickCount() - tick); tick = GetTickCount(); for(new i=0; i<100000; i++) { GetGVarInt("RandomID"); } printf("tick #4: %d",GetTickCount() - tick); tick = GetTickCount(); for(new i=0; i<100000; i++) { SOMETHING[randomshit] = i; } printf("tick #5: %d",GetTickCount() - tick); tick = GetTickCount(); for(new i=0; i<100000; i++) { i = SOMETHING[randomshit]; } printf("tick #6: %d",GetTickCount() - tick); return 1; }
Results:
[20:45:01] tick #1: 38
[20:45:01] tick #2: 33
[20:45:01] tick #3: 102
[20:45:01] tick #4: 100
[20:45:01] tick #5: 12
[20:45:01] tick #6: 2
I don't know anything about plugin programming, but could this be somehow speeded up a bit? GVars seem to be around three times slower than PVars.
|
Wow. Arrays blow PVar/GVar out of the water.
This plugin is useful but that speed difference is a dealbreaker. I'm better off using get/set/exist property.