Perl Benchmark IN sub with grep

If you miss the IN function in Perl like the function in PL/SQL, then you could use grep and an array to check this:

I made a Benchmark to check how fast his solution is:

Result:

We see the normal way is the fastest and you could use an defined array to speed up by 7%. The Code is short but much slower than an or comparison.

2 thoughts on “Perl Benchmark IN sub with grep”

  1. Hello everyone, it’s my first go to see at this site, and piece of writing is actually fruitful designed
    for me, keep up posting these posts.

  2. Hey very nice blog!! Guy .. Beautiful .. Wonderful
    .. I will bookmark your blog and take the feeds additionally?

    I’m glad to seek out numerous helpful info right here within the
    put up, we need develop extra strategies in this regard, thank you for sharing.
    . . . . .

Leave a Reply

Your email address will not be published.

five × five =