View Single Post
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-05-2014 , 11:58   Re: [INC] HPVars - Player variable's
Reply With Quote #6

The amount of memory you occupy by doing:
Code:
new nVar[MAX_PLAYERS][MAX_VARS][MAX_VARNAME];
new iVar[MAX_PLAYERS][MAX_VARS][MAX_VARINPUT]
is very expensive. If more than one plugin uses this system, you are now multiplying this memory usage by the number of plugins.

Also, having to look up a string within MAX_VARS before you can get/set a variable, makes these operations expensive too. Converting integers and floats to strings and back makes it even worse. Referencing/setting a variable is very fast in pawn; this system adds extra native calls for these simple operations.

The "ease of use" for "not creating" the variables is greatly outweighed by the extra memory and operations included in this system.

Other suggestions:


Look into Tries:

Last edited by Emp`; 09-05-2014 at 12:01.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`