in reply to Re^2: Benchmarking "Are all these characters in this sentence?"
in thread Benchmarking "Are all these characters in this sentence?"

Try it this way. I believe it addresses both the real and conceptual errors and runs even faster:

buk3 => sub { 1+index $_[0], chop $_[ 1 ] or return for 1 .. length $_[ 1 ]; 1; },

Who says optimisation can't also result in correct code. Such fun :)


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.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re^3: Benchmarking "Are all these characters in this sentence?" (Faster still?)
  • Download Code

Replies are listed 'Best First'.
Re^4: Benchmarking "Are all these characters in this sentence?" (Faster still?)
by RMGir (Prior) on Sep 01, 2008 at 11:57 UTC
    You're right - that passes all tests and wins by a good margin.

    You're quite good at this game :)

    I'll update the parent post.


    Mike