Thread: [Plugin] GVar Plugin
View Single Post
Old 29/05/2010, 07:08 PM   #11
Sergei
High-roller
 
Sergei's Avatar
 
Join Date: Mar 2008
Location: Slovenia
Posts: 2,905
Reputation: 230
Default Re: [REL] GVar Plugin v1.0

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 Code:
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.
__________________
Watch out, scouts everywhere!
Sergei is offline   Reply With Quote