is worth and possible cache user ip and auth in index as global string var?
Well i got my custom plugin its about 4k lines and i thinking about few simple optimisations so get_user_ip and get_user_authid exists in 11 functions its useless to getting same results for same id everytime its called. As far i have done research that calling such things may cause cpu usage, why just don't save it to memory for every player index, on client putinserver event it could be cached to an string variable, as player disconnect called client disconnect event, the ip and authid will be reseted to zero. Also its impossible that authid or ip can be changed in realtime @server.
Okay for the questions.. Is this worth (i see less cpu chokes, slutters, less cpu usage)? Is this possible (cache ip and auth in player index (global string variable))? I know that this will use a bit more memory, can i expect memory garbages? |
Re: is worth and possible cache user ip and auth in index as global string var?
Quote:
Quote:
|
Re: is worth and possible cache user ip and auth in index as global string var?
Quote:
and how about memory garbages? |
Re: is worth and possible cache user ip and auth in index as global string var?
Quote:
Quote:
|
Re: is worth and possible cache user ip and auth in index as global string var?
Quote:
memory leaks*, I am sorry |
Re: is worth and possible cache user ip and auth in index as global string var?
PHP Code:
|
Re: is worth and possible cache user ip and auth in index as global string var?
Quote:
done myself i think more efficient way, but on client_disconnect don't know how to reset PHP Code:
|
Re: is worth and possible cache user ip and auth in index as global string var?
Regex is NOT a more efficient method and should not be used here since the possible outputs of get_user_authid() and get_user_ip() are very limited (in fact, the IP output from the function will always be valid). Connor's method will be more efficient.
|
Re: is worth and possible cache user ip and auth in index as global string var?
But you can use global variables as you did, also steamid array size doesn't need to be 64, 32 is enough.
|
Re: is worth and possible cache user ip and auth in index as global string var?
Or just use the AMXX natives each time you need them, because they're fast and caching them is trivial and can only cause headaches.
|
| All times are GMT -4. The time now is 15:58. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.