in reply to Boyer Moore algorithm

Can you first explain what your intended use is?

Using the regexp engine, you get Boyer-Moore when appropriate, automatically. And if for some reason you can't use the regexp engine, I would be surprised (though I haven't benchmarked) if a pure-Perl implementation of Boyer-Moore would beat Perl's native index (Update: which internally uses Boyer-Moore).


Dave

Replies are listed 'Best First'.
Re^2: Boyer Moore algorithm
by BrowserUk (Patriarch) on Feb 10, 2014 at 23:26 UTC
    I would be surprised (though I haven't benchmarked) if a pure-Perl implementation of Boyer-Moore would beat Perl's native index.

    I have. It's not even in the same eon.

    And, whilst I won't dare to suggest my Inline::C implementation was perfect, even in C it didn't come close to beating index. The overhead of transitioning from Perl through Inline to C and back, wiped out any gains.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.