Mail Archives: djgpp/1997/02/02/05:02:29
Pyro Technic wrote:
>
> I've got a weird question, wich would be faster and how would I
> measuree it. Would doing 2 things 3 times be faster or slower than doing
> 3 things 2 times.
If the code inside the loops is identical (i.e., you don't need to do
something wierd to the code if 'i' and 'j' need to be reversed, then
they should run at exactly the same speed. What matters isn't the
number of loops, but what's inside them.
Alternatively, if you're compiling with maximum optimizations and the
compiler decides that one or more of those loops can be "unrolled", then
you might see a difference, but that's really esoteric and not realistic
to consider for most programs. :)
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com |
| God's final message to His Creation: | http://www.cs.com/fighteer |
| "We apologize for the inconvenience."| Fight against proprietary |
| - Douglas Adams | software - support the FSF!|
---------------------------------------------------------------------
- Raw text -