Question on optimization
#3

You shouldn't do it EVERY TIME, you should store to variables at the launch of the server or once a player connects (depending on what it is you're checking) and then update the variables depending on what effects them i.e. if you want to check a players cash, when the player connects, store his cash from MYSQL to a variable, then update the variable whenever the players cash is effected, then check the variables, when the player disconnects, update the variables.

Somethings you can't really store to a variable and so reading from your database is the only option, if you're using a server host, depending on how much data you're reading, it shouldn't be noticeable, but if you're home hosting, it'll always be noticeable with server lag on anything over 10-20 rows.
Reply


Messages In This Thread
Question on optimization - by Seifspeed - 11.07.2018, 12:05
Re: Question on optimization - by DuyDang2412 - 11.07.2018, 14:50
Re: Question on optimization - by ItsRobinson - 11.07.2018, 17:36
Re: Question on optimization - by GospodinX - 12.07.2018, 11:12
Re: Question on optimization - by Banditul18 - 12.07.2018, 11:49

Forum Jump:


Users browsing this thread: 1 Guest(s)