Profiler Plugin results
#1

I've used profiler plugin for analyzing my gamemode performance and got these results. Now the question is, the average download rate for 30 players on my server is 40 ~ 50 kbps, and the results show OnPlayerUpdate is getting most of the data from user when I put nothing inside OnPlayerUpdate callback. Its empty. What could be it ? There is something causing lag.. and yes I've tdm server where players are closer to each other, could be one of the facts of OnPlayerUpdate taking too much data, and causing lag for everyone but how do I prevent it? or is it some other function or callback causing it?
Reply
#2

One of your includes might use it, it's most certainly not empty if it's getting profiled by the plugin.
Reply
#3

Quote:
Originally Posted by PrO.GameR
View Post
One of your includes might use it, it's most certainly not empty if it's getting profiled by the plugin.
These are all the includes im using and I dont think anyone except streamer has a little bit role in it, aint it?
Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <foreach>
#include <YSI\y_ini>
#include <irc>
#include <Dini>
#include <geolocation>
#include <streamer>
#include <crashdetect>
Reply
#4

I don't think any of these rely on OnPlayerUpdate but you'd have to check them one by one to make sure. Distance functions are also at the top of the list so there may be some room for improvement there, too. Use VectorSize; judging by the enormous amount of calls to floatsqroot and floatabs it seems you're still using the old and slow method.
Reply
#5

Quote:
Originally Posted by Vince
View Post
I don't think any of these rely on OnPlayerUpdate but you'd have to check them one by one to make sure. Distance functions are also at the top of the list so there may be some room for improvement there, too. Use VectorSize; judging by the enormous amount of calls to floatsqroot and floatabs it seems you're still using the old and slow method.
Heres what I am using:

Code:
public Float:GetDistanceBetweenPlayers(p1,p2)
{
    new Float:x1,Float:y1,Float:z1b,Float:x2,Float:y2,Float:z2b;
    if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) {
        return -1.00;
    }
    GetPlayerPos(p1,x1,y1,z1b);
    GetPlayerPos(p2,x2,y2,z2b);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2b,z1b)),2));
}
For checking speed per second:
Code:
 GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
	GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
	else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
    return floatround(ST[3]);
}
Reply
#6

Just replacing those two with these two will affect your performance greatly.

PHP Code:
Float:GetDistanceBetweenPlayers(playerid,secondplayerid)
{
    new 
Float:pXFloat:pYFloat:pZ;
    
GetPlayerPos(secondplayeridpXpYpZ);
    return 
GetPlayerDistanceFromPoint(playeridpXpYpZ);

PHP Code:
 GetPlayerSpeed(playerid)
{
    new 
Float:ST[4];
    if(
IsPlayerInAnyVehicle(playerid))
    
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else 
GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    return 
Floatround(VectorSize(ST[0],ST[1],ST[2])*179.28625);

However judging by this piece of your code, I would say your whole GM is just as poorly-optimized as these.
Reply
#7

Quote:
Originally Posted by PrO.GameR
View Post
Just replacing those two with these two will affect your performance greatly.

PHP Code:
Float:GetDistanceBetweenPlayers(playerid,secondplayerid)
{
    new 
Float:pXFloat:pYFloat:pZ;
    
GetPlayerPos(secondplayeridpXpYpZ);
    return 
GetPlayerDistanceFromPoint(playeridpXpYpZ);

PHP Code:
 GetPlayerSpeed(playerid)
{
    new 
Float:ST[4];
    if(
IsPlayerInAnyVehicle(playerid))
    
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else 
GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    return 
Floatround(VectorSize(ST[0],ST[1],ST[2])*179.28625);

However judging by this piece of your code, I would say your whole GM is just as poorly-optimized as these.
Thanks, possibly but these two are frequently used as per second.


Quote:
Originally Posted by Vince
View Post
I don't think any of these rely on OnPlayerUpdate but you'd have to check them one by one to make sure. Distance functions are also at the top of the list so there may be some room for improvement there, too. Use VectorSize; judging by the enormous amount of calls to floatsqroot and floatabs it seems you're still using the old and slow method.
Thanks but all those includes are very well known, what do you think it could be ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)