Optomization
Which is faster?
This: Code:
or This: Code:
In a function called say....in a EventDamage hook. (called a LOT) Just kinda curious.... |
Re: Optomization
In something like the Damage event I highly doubt you will see a difference, you could profile it to test but I wouldn't waste the time. If you were using PreThink or something called an insane amount of times then static would be better.
|
Re: Optomization
With single-cell variables like that, it really doesn't matter much unless you are creating like 20 different ones.
Also, when you reinitialize the static variable, you use more CPU usage because it has to set the value again, so making it static doesn't necessarily save you much here. It's best used for arrays or lots of single-cell variables in a frequently called code block. |
Re: Optomization
Ok. Thanks guys!
|
Re: Optomization
Quote:
http://forums.alliedmods.net/showthr...807#post523807 ]Liverwiz With damage event/forward, use new |
| All times are GMT -4. The time now is 06:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.