[Optimize] Loop
Whats better usage and performance?
PHP Code:
PHP Code:
PHP Code:
|
Re: [Optimize] Loop
I think 3rd usage would be the best, but I would change one thing:
PHP Code:
|
Re: [Optimize] Loop
Instead of trying to avoid unassigned/spectator, just look for what you want which is players on a team. A switch is really only good if you want to react a number of different ways based on a value. Here an if-statement is better since you only want to do something if player is on a team which is easy since T=1 and CT=2.
PHP Code:
|
Re: [Optimize] Loop
Quote:
|
Re: [Optimize] Loop
Acording to: http://wiki.alliedmods.net/Optimizin...X_Scripting%29
Quote:
PHP Code:
You can use: PHP Code:
PHP Code:
As you can see in this case it is not worth arguing, but still I think switch is more efficient. |
Re: [Optimize] Loop
Quote the text please, I want to read where you obtained this information.
Even if it turns out to be a smidgen more efficient I would still use my method. You need to draw the line somewhere between being a hair more efficient and readability/less code. |
| All times are GMT -4. The time now is 19:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.