From: Thomas Hurst Date: 2008-01-15T02:03:09+09:00 Subject: Re: 1.9 significantly slower than 1.8 on Mac * Derek Chesterfield (groups@dezuk.com) wrote: > On 13 Jan 2008, at 02:15, Marcin Miel??y??ski wrote: > >> Ruby 1.9 uses Oniguruma which is an encoding agnostic engine. > > So Ruby 1.9.0's Regexp is slower than 1.8's? In some cases, probably; it does quite a bit more, not just in encoding support, but more regexp features. e.g, from a quick glance through http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt : Zero-width lookbehind assertions (/(?<=foo)bar/ =~ 'foobar' # $& => "bar") Named captures (/(?bar))/ =~ 'foobar' # $~[:foo] => "bar") Fancier backreferences (/(?foo|bar)\k/ =~ "foobar" # => nil, .. =~ 'foofoo' # $& => "foofoo") The ability to call subexpressions (/(?foo|bar)\g/ =~ "foobar" # $& => "foobar", $2 => bar) You might consider installing a separate Ruby 1.8 with Oniguruma patched in, or installing the Oniguruma gem, so you can test the performance without bringing YARV into the equation. > Damn - All my Ruby scripts make extensive use of Regexp. Will this > always be the case, or might 1.9.1 be worth me upgrading to? Oniguruma's pretty mature by now, I wouldn't expect the general performance profile to change that significantly, although the recent port to Java might trigger some changes. I wouldn't be too worried; I've used it for well over a year and not really noticed any significant performance issues. In the worst case, alternative engines could always be supported through extensions. -- Thomas 'Freaky' Hurst http://hur.st/