Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Hypothesis: some magic string optimalization in perl kills my server from time to time

by tybalt89 (Monsignor)
on Sep 30, 2016 at 15:30 UTC ( [id://1173006]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Hypothesis: some magic string optimalization in perl kills my server from time to time
in thread Hypothesis: some magic string optimalization in perl kills my server from time to time

Which regex does it stop at?

  • Comment on Re^3: Hypothesis: some magic string optimalization in perl kills my server from time to time

Replies are listed 'Best First'.
Re^4: Hypothesis: some magic string optimalization in perl kills my server from time to time
by leszekdubiel (Scribe) on Sep 30, 2016 at 15:38 UTC

    The program doesn't stop at any of regexpes. It finishes computations sucessfully, but sometimes it takes quite short, and sometimes it takes very long.

    For example on 2Mb of data, when I call "list_extr" like this:

    list_extr(\( "(" . $big_string . ")" ));

    it takes only half a second. But if I call like this:

    my $ttt = "(" . $big_string . ")"; list_extr(\$ttt);

    it takes 20 seconds (slower 40x times). Why? Both ways look the same -- make string with parentheses around old string, take reference to it, do same computations. So if they are the same why the difference in time? I think perl is doing some magic here, but only someone more expierenced would tell.

      Which regex is the slow one?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1173006]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-19 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found