From: Rick DeNatale Date: 2006-09-05T08:29:32+09:00 Subject: Re: Compiling Regexp only once On 9/4/06, Robert Klemme wrote: > Note though that it's usually faster to have a regexp in line. So in > your case you might have a method that does the line parsing (or > multiple line parsing) and that's where you can put the inline regexp > for max efficiency. Robert, I'm not sure what you mean by inline, do you mean a regexp literal like /[ABC]/ vs. RegEx.new('/[ABC]/') if so that's not clear. See my benchmarks on the thread about "Ordered contrast for String or Array," where changing a literal /./ to a constant set to RegEx.new('/./') caused a 200 fold performance increase. Not that you always want to do that, benchmarking always beats rules of thumb. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/