Raised This Month: $ Target: $400
 0% 

COD: HitMarkers v1.7 [Updated April 29th 2021]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-10-2020 , 12:17   Re: COD: HitMarkers [Last Update: 24/01/2020]
Reply With Quote #24

Quote:
Originally Posted by georgik57 View Post
Any mod which gives a lot of health to players will trigger it a lot(for example zombie mods).
That's still not a lot.

get_pcvar_num is not an expensive operation: it's an O(1) time complexity operation(this is why we use pcvars over cvars, we don't need to iterate over the entire cvar list because we have a pointer and we can simply access the value that the pointer points to).
Reading the data from the variable that caches the cvar is also O(1) so if you are not trying to optimize that why are you trying to optimize something that's equivalent?

Truth be told, that's half the story. Since get_pcvar_num is a native there's also some time spent in communicating between pawn and c++, BUT it's nothing to worry about in the context of a TakeDamage call. You could argue about caching O(1) natives if your forward was called per frame, but TakeDamage is not and the fact that it may be fired for a few seconds on 16 zombies is literally nothing.

I don't know why people insist on doing worthless "optimizations" that will not provide any speed gain, require more coding time and hurt the user experience. Think about your algorithms and how the plugin is operating as a whole, not small insignificant things. A bad algorithm is a bad algorithm no matter how many cvars you cache, how many times you use static over new or how many bitsums are used over boolean arrays. On the other hand, a good algorithm remains good even if it doesn't cache cvars.
__________________

Last edited by HamletEagle; 02-10-2020 at 12:21.
HamletEagle is offline
 



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 09:07.


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