On Sep 5, 2006, at 7:10 AM, Devin Mullins wrote: > Eric Hodel wrote: >> So literal regular expressions are "faster" by about 56% (after >> discounting loop overhead) (when you're performing 100 million >> retrievals only) (actual speedup in real code will probably be >> swallowed elsewhere or completely irrelevant). >> This follows from reading eval.c. Constant lookup involves a >> bunch of C function calls, but literal lookup just returns an >> Object stored in the parse tree. > Interesting. Note that this is different from your benchmark in > ruby-talk:204747, wherein much of the savings seems to come from > not having to instantiate & populate a MatchData. Compare: Vastly different. He's calling scan/split instead of s =~ //. s =~ // is the fastest way to invoke a match as you avoid the method dispatch altogether.