Raised This Month: $ Target: $400
 0% 

Plugin Optimization Help KeyValues


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 04-27-2010 , 05:40   Re: Plugin Optimization Help KeyValues
Reply With Quote #1

I prefer to use static arrays and enums like that because they are much faster than KV (and adt arrays). However they reserve memory for the whole array, while KV and adt arrays grow and shrink. For small arrays that reserved memory is no big deal (that Settings array is just ~6 KB).

I'm not that concerned about the memory usage, but the performance. Static arrays are fast. Implement some wrapper functions to easily add remove or modify elements in the array. Notice the InUse element in my previous example to simply mark whether a index (player) is in use or not.

Use static arrays if you want the best performance. KV and adt arrays have a tiny overhead due to the native calls. The overhead is trivial, but you might want to save some time in bigger loops and busy events like game frame or weapon fire events. That's why you want to cache the data anyways, in static arrays.
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)

Last edited by rhelgeby; 04-27-2010 at 05:48.
rhelgeby is offline
Send a message via MSN to rhelgeby
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode