Optimizing code.
Hai, how i can optimize this part of code?
PHP Code:
|
Re: Optimizing code.
Only thing I can see wrong is calling sizeof when you probably already know the size. Waste of resources. Can't tell you more without understanding what you're trying to do, which I don't.
|
Re: Optimizing code.
Quote:
|
Re: Optimizing code.
Hmm. Ok then. O_o
|
Re: Optimizing code.
I think 2nd "if" can be "else if", same with 4th.
|
Re: Optimizing code.
Quote:
|
Re: Optimizing code.
I suspect that this could be optimized more, if I could see more of your code. I'm not sure.
Anyways, I'm not sure if this is compatible with your code. I think it will probably work: PHP Code:
|
Re: Optimizing code.
What you want this to do:
PHP Code:
Find the first (equal( szTarget, szCounterStart[i]) or the last one? As you have it its finding the last one. If it can be the first, add a break. If you want the last one change the for to PHP Code:
If you explain it more i can optimize it. |
Re: Optimizing code.
If i understood it right:
PHP Code:
Edit: i think that i understood it wrong or there is something wrong with the provided code. I will leave the code here anyway. I will try to optimize when xPaw explain he's code. I think that this: PHP Code:
|
Re: Optimizing code.
From what I understood, it's a very simple snippet, what it does is check if an entity is a 'func_button'. If positive, loop through two string sets, checking if the target name matches. If it does, store the entity index on gButtons[START], if it's the first match, or gButtons[START2] if one was already found. Do the same with the stop buttons.
My attempt: Code:
new iStartCount = 0, iStopCount = 0 |
| All times are GMT -4. The time now is 02:19. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.