Did you try it with perl 5.10 or newer?

Yes, as1000/v5.10. As you can see below, the 14000 (last) run is aborted after 16 minutes elapsed and 15+ minutes of cpu. I'll leave it running while I sleep and see what happens.

#! perl -slw use strict; use constant { CHROM => 'chromosome.txt', PROBES => 'probes.txt', }; our $N ||= 1000; my $chrom; open C, '<', CHROM or die CHROM . ": $!"; sysread C, $chrom, -s( CHROM ) or die $!; close C; $chrom = uc $chrom; open P, '<', PROBES or die $!; my @probes = <P>; close P; chomp @probes; warn "Trying $N probes with perl $]"; warn time; my $re = join '|', @probes[ 0 .. $N ]; $re = qr[($re)]; print "$1 : $-[ 0 ]" while $chrom =~ m[$re]g; warn time; __END__ [13:47:01.65]C:\test>\Perl510\bin\perl5.10.0.exe -s 668954.p10 -N=1000 + > nul Trying 1000 probes with perl 5.010000 at 668954.p10 line 21. 1203515291 at 668954.p10 line 23. 1203515295 at 668954.p10 line 29. [13:48:16.15]C:\test>\Perl510\bin\perl5.10.0.exe -s 668954.p10 -N=1200 +0 > nul Trying 12000 probes with perl 5.010000 at 668954.p10 line 21. 1203515310 at 668954.p10 line 23. 1203515335 at 668954.p10 line 29. [13:50:56.37]C:\test>\Perl510\bin\perl5.10.0.exe -s 668954.p10 -N=1300 +0 > nul Trying 13000 probes with perl 5.010000 at 668954.p10 line 21. 1203515469 at 668954.p10 line 23. 1203515494 at 668954.p10 line 29. [13:51:35.67]C:\test>\Perl510\bin\perl5.10.0.exe -s 668954.p10 -N=1400 +0 > nul Trying 14000 probes with perl 5.010000 at 668954.p10 line 21. 1203515696 at 668954.p10 line 23. Terminating on signal SIGINT(2) ### Over 15 minutes of CPU used by th +is point [14:08:03.32]C:\test>

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."

In reply to Re^4: pattern match, speed problem by BrowserUk
in thread pattern match, speed problem by spring

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.