Is here any diff in these lines?
Hello. i want to know is here any difference if i check everything in one line or in two?
here is example Code:
public FW_PlayerPreThink(id)Code:
public FW_PlayerPreThink(id)which one of above examples is better by performance side? Or they both are same? |
Re: Is here any diff in these lines?
There are no difference but :
if (!is_user_alive(id) || !zp_get_user_zombie[id]) return PLUGIN_CONTINUE :arrow: if (!is_user_alive(id) || zp_get_user_zombie[id]) return PLUGIN_CONTINUE |
Re: Is here any diff in these lines?
i would use it like this
PHP Code:
PHP Code:
|
Re: Is here any diff in these lines?
So in both examples plugin will use same ammount of calls?
my thoughts about these in case of dead user: in first example plugin check if user alive and if not returns - one call (zombie check not called) in second example plugin check if user alive or is not zombie - two calls. Or plugin returns just after if_user_alive check? |
Re: Is here any diff in these lines?
Quote:
On the other side, in this code: Code:
|
Re: Is here any diff in these lines?
hmm, if FW_PlayerPreThink called 100 per second, and server have 32 players, so then i save 1 call in code, i save 3200 calls per second? Or iam wrong? :)
|
Re: Is here any diff in these lines?
Quote:
|
Re: Is here any diff in these lines?
Yea, but that was just an example, if i save 10 calls, whats already 32k saved calls per second. If i review all plugins and save say 50 calls, whats will be 160k :)
|
Re: Is here any diff in these lines?
Then I suggest you to go there, save 150k calls and tell me if you see the difference.
|
Re: Is here any diff in these lines?
So, after big and hard work of my plugins and optimizations here is a result:
[IMG]http://img715.**************/img715/5404/graphimage.png[/IMG] Still you think it is insignificant? :nono: Ofcourse, it is not a result only of those seperated "if" checks, but if you optimize a everything you can, you can reach a really good results. |
| All times are GMT -4. The time now is 00:12. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.