in reply to Re: An efficient way to parallelize loops
in thread An efficient way to parallelize loops

Hi javaFan

Thanks for your help. The patterns are not complex, but long, since they're made of all the elements of long arrays, separated by "|" (with the intent of alternatively match different patterns).

As you suggested before, I already precompile the regex with qr// operator, which already sped up the code.

I'll try to swap the loops, though, to see if there's any improvement, and I'll do some profiling as well.

Many thanks again for your help!

  • Comment on Re^2: An efficient way to parallelize loops

Replies are listed 'Best First'.
Re^3: An efficient way to parallelize loops
by moritz (Cardinal) on Jun 01, 2010 at 11:36 UTC
    The patterns are not complex, but long, since they're made of all the elements of long arrays, separated by "|" (with the intent of alternatively match different patterns).

    Then you'll likely benefit from running perl 5.10 or newer, since it implements a Trie optimization for alternations of literal patterns. If the arrays are really huge, you could increase the value of ${^RE_TRIE_MAXBUF} to make them all fit into the same trie.

    Perl 6 - links to (nearly) everything that is Perl 6.

      I've been working on a machine which is not run by me. There's only a 5.8 perl environement, and no way to get it upgraded.

      Thanks for the hint though.