From: Brian Candler Date: 2009-07-01T20:31:29+09:00 Subject: Re: Making a random string Eleanor McHugh wrote: > As to the notion that we should only write performant code in C... why > complicate a codebase by using two languages (with all the debugging > nightmare that can entail) if the language you're already working in > is capable of doing the job anyway? "Doing the job" is the critical part of that sentence. In my opinion, if (and only if) your existing program won't do the job within acceptable parameters, should you start modifying the code to make it acceptable. Since you should have "done the simplest thing that will possibly work" in the first place, then by definition, the modified code will be more complex. But more importantly: profile first, modify second. I find it highly unlikely that in a real-world program, removing that one single hidden string dup will make a noticeable improvement. More likely you'll want to change your algorithm or data structures. Of course, if in your particular application this change *does* improve performance noticeably, then by all means make the change (and add a comment as to why it was necessary to write it in a non-obvious way, so that somebody doesn't simplify it back again later). But I think that's the point: write more complex code *only* if it makes a measurable improvement, not on the off-chance that it might. -- Posted via http://www.ruby-forum.com/.