From: Dave Howell Date: 2006-06-02T05:35:31+09:00 Subject: Re: How use Profiling, a Quick Guide. On Jun 1, 2006, at 13:17, Sam Roberts wrote: >> Er, the profile list? Push "Where do I find/how do I generate a >> 'profile list'?" onto the question_stack > > 'profile', in the std lib Alas, you have still underestimated how clueless I am. 'the std lib'? Is that a Ruby standard library? A Unix standard library? And if I find this library, what do I do with it? How would I invoke profile-omancy? >> question_stack << "[Error: File 'strace' Not Found]" > > ktrace on BSD systems Oo! My command line liked that much better. The man page even has examples. Whether or not I can figure out what it's telling me, and if so, what I'm supposed to do about it, remains to be seen, but it's certainly a start. >>> * Large number of calls to .size and .length and .count_objects >>> methods are a >>> clue some nidjit somewhere is doing something really N^2 stupid >>> like... >>> for( i=0; i < container.count_objects(); i++) { >>> } >> >> question_stack << "What exactly is stupid about that? And what's the >> smart alternative? > max=container.count_objects() > for( i=0; i < max; i++) { > } > > container.each.... OK, so "container.each" is presumably the smart alternative, and what I'd instinctively use anyway, but I don't understand what it is about "for( i=0; i < max; i++)" that makes it "really n^2 stupid." (If n, or N, = 1, then that wouldn't be all that stupid, but the use of the term "nidjit" leads me to guess n is likely to be at least the age of said nidjit, or some other suitably > 1 value. :)