James G. wrote:
On Mar 10, 2006, at 4:57 PM, Alan B. wrote:
I first saw
that the array class mixed in enumerable and that I could use the to_a
call from there, but a quick check using -r profile showed that my
original call to split was a much quicker way to convert from a string
to an array.This sounds like premature optimization. Remember, you start
worrying about speed when the code gets too slow. Not before.James Edward G. II
James:
I’m going to have to respectfully disagree. I guess maybe I’m getting
to old to code, but I first learned assembler and then C. Assembler
served me well in that I knew how to write the fastest, least resource
intensive C. Back in the early 80s on a VAX running V7 UNIX that was
more important than maintainability. As I’ve continued my craft and
learned many other languages, I’ve found that truly understanding what’s
happening “under the hood” of any language was the key to writing code
that didn’t break, executed quickly, and kept clients happy.
Furthermore, there’s something in me that makes me better love the
language when I completely master it. I don’t believe the language is
mastered until one understands things such as why one construct executes
quicker than another. I can now picture how a mix-in works and why
calling the to_a mix-in is a slower construct. I don’t understand all
the nuances of that yet, but I intend to and that will make Ruby that
much more enjoyable to me.
Thanks for a different insight,
Alan

I’m all for not prematurely