Raised This Month: $ Target: $400
 0% 

Such approach is a performance loss or is it irrelevant? [solved]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-04-2015 , 13:00   Re: Such approach is a performance loss or is it irrelevant
Reply With Quote #1

Run it and see what happens. The code that you've shown is relatively small compared to many plugins that use these hooks. However, get_user_weapon() will not always get the weapon with which the damage was caused. For example, if when someone is injured by a grenade, the attacker might not be holding a grenade.
__________________
fysiks is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 10-04-2015 , 14:28   Re: Such approach is a performance loss or is it irrelevant
Reply With Quote #2

Quote:
Originally Posted by fysiks View Post
Run it and see what happens. The code that you've shown is relatively small compared to many plugins that use these hooks. However, get_user_weapon() will not always get the weapon with which the damage was caused. For example, if when someone is injured by a grenade, the attacker might not be holding a grenade.
Thank you for you time. And that get_user_weapon() is what I am worried about, but not because the grenade problem, because there will be no Golden Grenades.
  1. It is because all the time that someone get injured they will be:
  2. An "if( attacker > 0 )", and ifs to the processor are bad.
  3. A "new currentSpecialWeapon = get_user_weapon(attacker, clip, ammo)", which I don't know if it is quick as access a local constant value, or if it has a lot of cost and should not be executed every use shot.
  4. Another "if( g_whichSpecialWeapon[attacker] == currentSpecialWeapon )", which access a array position and the currentSpecialWeapon got before at 2).
  5. Finally, the "SetHamParamFloat(4, damage * g_weapon_damage )", which I don't know how much costly is it/are Ham functions, specially this one.

Hence, are these steps light weight or heavy weight?
For now, I am keep follow what you said.
  1. A will keep analyzing my server performance and ping with it and without it.
  2. I will keep studying and getting to know better these functions/ifs performance impact.

Last edited by addons_zz; 07-26-2016 at 20:00. Reason: fixed formatting.
addons_zz 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 22:16.


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