This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Question on efficiency.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Y060N
BANNED
Join Date: Dec 2011
Location: www.equilibriumcs.com
Old 03-28-2012 , 10:59   Question on efficiency.
Reply With Quote #1

Is it more efficient to call from a native, or use an array if that particular thing is called many times per second?

Example:
In zombie mod, I check (with natives) in fw_TakeDamage. But, I check about 10 things before anything is actually done. I was wondering if it's better to save into arrays when someone in infected, a boss, etc. and then check against their IDs in the array.

Please let me know asap, and I appreciate it!
Y060N is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-28-2012 , 11:04   Re: Question on efficiency.
Reply With Quote #2

Since TakeDamage can be called very often with a full server, it would not be a bad idea to cache the result into a variable, and avoiding the call of the native.
__________________
Arkshine is offline
Y060N
BANNED
Join Date: Dec 2011
Location: www.equilibriumcs.com
Old 03-28-2012 , 11:53   Re: Question on efficiency.
Reply With Quote #3

Thanks I appreciate it, yeah my server is usually 25-32 people so it is called often and with natives it's 10 checks, with an array it's only 3 checks.

Thanks
Y060N is offline
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 03:36.


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