[MacRuby-devel] Regular expression related performance

Laurent Sansonetti lsansonetti at apple.com
Fri Dec 3 00:38:10 PST 2010


Hi Yasu,

On Dec 2, 2010, at 9:37 PM, Yasu Imao wrote:

> Hi Laurent,
> 
> I filed a ticket on String#gsub performance.

Thanks :)

> While I was playing with regex, I noticed another difference(?) between Ruby 1.8.7 and MacRuby.  
> 
> In Ruby Regexp class, fixnums assigned to Regexp.new options are different with Ruby 1.8.7 and with MacRuby
> 
> Ruby 1.8.7
> 
> p Regexp::IGNORECASE => 1
> p Regexp::MULTILINE => 4
> p Regexp::EXTENDED => 2
> 
> MacRuby
> 
> p Regexp::IGNORECASE => 2
> p Regexp::MULTILINE => 32
> p Regexp::EXTENDED => 4
> 
> Is this because of the difference between Ruby 1.8 and Ruby 1.9 or between Oniguruma and ICU?  Or was there a decision to assign different fixnums to these?

It's actually an implementation detail so far. We can eventually make sure the fixnum values of these constants are the same as CRuby (if you file a ticket we will fix that for 0.8). I think that users should use the constants and not the fixnum values directly in their code, though.

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101203/f0fbaba6/attachment.html>


More information about the MacRuby-devel mailing list