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
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-04-2015 , 14:49   Re: Such approach is a performance loss or is it irrelevant
Reply With Quote #1

We can't answer, a plugin alone won't usually cause any clear difference(of course, if not using, for example, per frame forwards badly with crap code).

What you can do is to remove CurWeapon event and also weapPickupEvent, and use Ham_Item_Deploy. Even with CurWeapon, you don't need the weapPickupEvent, but Item_Deploy is better than CurWeapon, it's called only at the moment when you need to show the model again.

Ham_TakeDamage is using game default function(for players it should be CBasePlayer::TakeDamage), and it's okay to use it too. Generally, if it's ok for the game it should be ok for you too.

For example, instead of:
PHP Code:
 give_item(id,"ammo_9mm");
    
give_item(id,"ammo_9mm");
    
give_item(id,"ammo_9mm");
    
give_item(id,"ammo_9mm"); 
You could use cs_set_user_bpammo to save some native calls, even if kinda trivial. give_item firstly creates an entity then force touch between the ent and the player, cs_set_user_bpammo is a more direct way, it alters directly the m_rgAmmo offset.

Edit: About your last post, it's bullshit, don't try to micro optimize, why you are afraid of few checks ?
__________________

Last edited by HamletEagle; 10-04-2015 at 14:52.
HamletEagle is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 10-04-2015 , 17:52   Re: Such approach is a performance loss or is it irrelevant
Reply With Quote #2

Quote:
Originally Posted by HamletEagle View Post
We can't answer, a plugin alone won't usually cause any clear difference(of course, if not using, for example, per frame forwards badly with crap code).

What you can do is to remove CurWeapon event and also weapPickupEvent, and use Ham_Item_Deploy. Even with CurWeapon, you don't need the weapPickupEvent, but Item_Deploy is better than CurWeapon, it's called only at the moment when you need to show the model again.

Ham_TakeDamage is using game default function(for players it should be CBasePlayer::TakeDamage), and it's okay to use it too. Generally, if it's ok for the game it should be ok for you too.

For example, instead of:
PHP Code:
 give_item(id,"ammo_9mm");
    
give_item(id,"ammo_9mm");
    
give_item(id,"ammo_9mm");
    
give_item(id,"ammo_9mm"); 
You could use cs_set_user_bpammo to save some native calls, even if kinda trivial. give_item firstly creates an entity then force touch between the ent and the player, cs_set_user_bpammo is a more direct way, it alters directly the m_rgAmmo offset.
Thank you for your time. I am going to adjust the code.

Quote:
Originally Posted by HamletEagle View Post
Edit: About your last post, it's bullshit, don't try to micro optimize, why you are afraid of few checks ?
Hey, hahhahaha. Because I want fun stuff at my server, but if this fun stuff causes lag, then I prefer don't have them at all. So, if I can make 'micro optimize' to get rid of lag and keep the good stuff, would it be a good trade, don't you think?

For example, if there is something that is executed at server side depending about the 'ping', and it could be implemented at another way where it is computed at client side, hence don't increasing the client't ping, would be a good trade if its improvement where good.

Like the Ham_TakeDamage, which is using the game default function. I am using it, instead of the original's SilverWeapon stranger techniques, which of course is more powerful because affects the cs built-in bots, but it is of course, a sacrifice that is a good trade for server's/client's performance.

Last edited by addons_zz; 10-04-2015 at 17:59.
addons_zz is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 10-04-2015 , 20:41   Re: Such approach is a performance loss or is it irrelevant
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
Edit: About your last post, it's bullshit, don't try to micro optimize, why you are afraid of few checks ?
PS: I just what to optimize a operation that happens every-time, like when you get shot. Not for those who just happens one time here. Not others like the 'cs_set_user_bpammo', to save some native calls which rarely happens.

If it was a operation that happens all the time, every second I would became worried about that, if it is not efficiently micro optimized. Unless it uses CPU time a lot, which I have. But it it used network bandwidth a lot, which I not have, I would became worried.

Last edited by addons_zz; 10-04-2015 at 20:46.
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