On Mon, Aug 20, 2012 at 6:57 AM, Charles Hixson <[email protected]> wrote:
> The point was that because it's hard to tell what is fast and what is slow, > bad decisions are often made. The situation is not that bad. For example, we know that - from a certain number of entries on - it is much faster to use hash lookup than sequential lookup. Where exactly the point is from which on it's faster depends on the specific situation (hit rate, hash functions etc.). Whether a particular piece of code is a significant performance hog in a certain program can only be judged by measuring. But sill it does make sense to use a Hash as general lookup tool which generally will be quite good decision. > I was using my current habit of avoiding > regular expressions as an example of that. There you have a bad habit IMHO. Regular expressions are often faster in Ruby because they are implemented in C and do not need to create as many objects with GC overhead as any solution implemented in Ruby is likely to have. > I had heard that the regular > expression parser had been totally re-written, but because it would take a > lot of work to find out the details, I tend to cling to an habit which may > now be bad, even though it was once appropriate. You do not need to know too many details; you could just try it out and measure it, don't you think? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ -- You received this message because you are subscribed to the Google Groups ruby-talk-google group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at https://groups.google.com/d/forum/ruby-talk-google?hl=en
