From: Charles Oliver Nutter Date: 2010-06-30T04:13:57+09:00 Subject: Re: Count substrings in string, scan too slow On Thu, Jun 24, 2010 at 2:48 PM, wrote: > :-( that wasn't the right one :-) > >  x.report 'boyer_moore' do >    TIMES.times do >      count = BoyerMoore.match("yo", s).size >      check count >    end >  end FYI, a large part of the overhead here is probably the Java calls, which are a bit slower than Ruby to Ruby calls (plus it's decoding the "yo" string to UTF-16 each call). For a larger string and fewer calls, the pure Java BoyerMoore performance would likely benchmark a lot better than this. - Charlie