From: Rick DeNatale Date: 2006-09-05T10:05:37+09:00 Subject: Re: Compiling Regexp only once On 9/4/06, Eric Hodel wrote: > On Sep 4, 2006, at 4:29 PM, Rick DeNatale wrote: > > > 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. > > Those aren't the same regular expression. I expect that your > benchmark is flawed. Oops, right you are. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/