Date: Sun, 2 Feb 1997 20:39:19 +0000 ( ) From: Gurunandan R Bhat To: "John M. Aldrich" Cc: djgpp AT delorie DOT com Subject: Re: Theoretical question of loops In-Reply-To: <32F48302.2186@cs.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sun, 2 Feb 1997, John M. Aldrich wrote: > 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. i think that if what you have inside is a reference to a matrix, for example a reference to a[i][j], then for very large matrices (but only for very large mind you) it does make a difference whether you access them columnwise or row wise.