George Ogata wrote:

> Another speedup:  replace:
> 
>   w.split(//).uniq.size == 11
> 
> with:
> 
>   w !~ /(.).*\1/
> 
> It's faster since there's less intermediate diddlage, but
> theoretically it shouldn't scale as well.  You'd have to increase your
> "11" quite a lot to notice it though I think.
> 

George:
Much thanks, I think that you've proved what I suspected, that Ruby is 
counting the time wrong with the profile (ruby -r profile script.rb) as 
when I subtract the profile time for the File.open block it's only a bit 
slower than the faster call.  I appreciate all the help and will try to 
ask a more difficult question next time.
I've always been fairly strong with regexes, but I'd have never thought 
to use one here.  Thanks for that as well.

David:
Thanks for chiming in, I'll check out your links as well.

Alan

-- 
Posted via http://www.ruby-forum.com/.