Code: Show/Hide // bad code
for (i = 0; i < 1000000; i++) { if (something) Func1(i); else Func2(i); } // good code if (something) for (i = 0; i < 1000000; i++) Func1(i); else for (i = 0; i < 1000000; i++) Func2(i); |
| Mr Ekted wrote: | |
Classic example (if you care about speed):
|
| D1st0rt wrote: |
| It only has to do the conditional branch once. |
| SamHughes wrote: |
| What should I do if looping through branches a million times is my favorite form of gambling? |
| SamHughes wrote: |
| What should I do if looping through branches a million times is my favorite form of gambling? |