>>  def match?(char1, char2)
>>    (EQUAL[char1.upcase.ord] & EQUAL[char2.upcase.ord]) != 0
>>  end
>
> That would be really easy to write tests and a benchmark against and
> then rewrite in C using RubyInline... without tests and a benchmark tho,
> you won't know that you've done it correctly and provides a measurable
> benefit.

They bottlenecks are the iteration over the sequence (while loop at line
68) and the vector_update (line 120). I am a bit surprised that match?
is that slow - I expect it to be almost instantaneous in C. I would like
to test that with a benchmark and Inline C.

And I just discovered RubyInline! Inline code is so much easier to deal
with that an external library IMHO. I have been messing a bit around
with "inline", but that turns out to be some old crappy gem!!! Its not
the first time I have missed the right gem :o( ...

However, I get a peculiar error when testing RubyInline with the first
of the examples:

http://pastie.org/1811057

I am on Ruby 1.9.2.


Cheers,


Martin

-- 
Posted via http://www.ruby-forum.com/.