Hello There, Guest! Login or Register


LVP 2.93 - What needs to happen?
#2
Fixed #305 already :)

I think before we work on these tickets we need to address the amount of queries and unoptimized functions contained within the user/gang handler.

* CheckUserExists - Function that gets called at least 3 times when a player connects, and once in the gang handler. This performs a query to clarify if a player is registered. This should only perform the query once and store the result in a variable. = DONE

* Profile IDs in the gang handler - This performs a query to determine a players profile ID and stores it to a variable when they connect in the gang handler. This already happens in the user handler and is stored to the PlayerInfo[playerid][playerProfile] variable, which we can use.

* Gang handler initialization. I'm going to quote the code for this:

Code:
#define     CUR_TURFS                     102

gangInitialize()
{
    for(new i; i < CUR_TURFS; i++)
    {
        CGang::T_WaitTimerOff(i);
        format(query, sizeof(query), "SELECT gang_id FROM turfs WHERE turf_id = %d", i);
        mysql_query(query);
        mysql_free_result();
        mysql_store_result();
        mysql_fetch_row_format(result);
        ActiveTurf[i][Owner] = strval(result);
...
}
That's performing 102 queries at once. I'm very surprised it doesn't bottleneck the server.

* CGang::PlayerConnect - This function is called from OnPlayerConnect and checks if a player is in a gang and updates all relevant information for the player. Surely this should be called when the player logs in!
- DONE

* mysql_free_result is called prior to every mysql_store_result function call. No idea why. - DONE

* CGang__GetNumberOfGangs() - This performs a query to get the result. Surely this can be stored in a variable.

* CGang__IsPlayerGangLeader(playerid) see above

* CGang__GetGangMoney(gangid) - see above
Reply


Messages In This Thread
LVP 2.93 - What needs to happen? - by Matthias - 11-06-2010, 09:06 AM
Re: LVP 2.93 - What needs to happen? - by Jay - 11-06-2010, 11:26 AM
Re: LVP 2.93 - What needs to happen? - by Jay - 11-06-2010, 02:36 PM
Re: LVP 2.93 - What needs to happen? - by MrBondt - 11-06-2010, 02:48 PM
Re: LVP 2.93 - What needs to happen? - by Jay - 11-06-2010, 03:00 PM