To: djgpp AT delorie DOT com Subject: Re: Theoretical question of loops Message-ID: <19970202.122229.4967.1.chambersb@juno.com> References: <32F443AF DOT 51CF AT dmv DOT com> From: chambersb AT juno DOT com (Benjamin D Chambers) Date: Sun, 02 Feb 1997 15:22:23 EST On Sat, 01 Feb 1997 23:35:11 -0800 Pyro Technic writes: >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. Depends on how large the code is. If the code fits in the cache, I would guess that 3 things 2 times would be faster - if it doesn't, then 2 things 3 times. (I'm guessing here, though :) ...Chambers > > >// loop set 1 >//is this faster >for(i=0; i<3; ++i) > { > for(j=0; j<2; ++j) > { > //stuff here > } > } > >// loop set 2 >//or is this >for(i=0; i<2; ++i) > { > for(j=0; j<3; ++j) > { > //stuff here > } > } > >weird stuff. Thanks a lot. > > Pyro >