[rescue] Small servers (was Re: WTT: 1.5G of PC2700 for 1G of PC100)

der Mouse mouse at Rodents.Montreal.QC.CA
Tue May 13 12:00:23 CDT 2008


> It's actually pretty easy to make serious algorithm mistakes.

One of my "favourite"s:

	for (x = 0; x < strlen(s); x ++)
		...

(when the string is not actually mutated inside the loop).  In a few
cases a really good compiler might be able to prove s is not mutated
and hoist the strlen, but in most cases I've seen the loop is too
complex (calls out to externally-compiled functions, just plain too
big, mutates the string but happens to never do so in ways that change
its strlen, whatever).

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse at rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B



More information about the rescue mailing list