I disagree.. Bad code is bad code.. Putting anything unnecessary inside of a loop is a waste of cpu cycles... UNIX systems tend to (in the real world) be used for high performance applications. Whether or not your particular application is intended to be high performance, why chew up processor time that could be used by other more important applications on the system.. -Rob ----- Original Message ----- From: Havoc Pennington Sent: Sunday, May 20, 2001 4:03 PM To: Robert Wilkens Cc: AndreKüster; gtk-list gnome org Subject: Re: Radiobuttons dont work? "Robert Wilkens" <RobertWilkens msn com> writes: > Please consider taking the 'if i==1' thing out of the loop... Do your initialization > before you enter the loop, then make the loop 'for i = 2 to 5' instead of 1 to 5. The > way your code is written it's not only doing an unnecessary compare, it's not only less > readable, but it's also doing that unnecessary compare with a branch *four* times in > the loop. X-windows is slow enough without bad code making it worse. >
The i == 1 there is so completely irrelevant to any real-world performance consideration it's not even funny. Worrying about it for that reason would be nuts.
Only code readability should be considered here.
Havoc
|