Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: "require Carp" may be hazardous to your code (assume)

by tye (Sage)
on Dec 05, 2006 at 20:02 UTC ( [id://587966]=note: print w/replies, xml ) Need Help??


in reply to Re^4: "require Carp" may be hazardous to your code (assume)
in thread "require Carp" may be hazardous to your code

Congratulations on your broken benchmark:

> perl -MTime::HiRes -le"print $INC{'Carp.pm'}" .../Carp.pm

Note that you also didn't address that this practice predates the factorying out of the "heavy" parts.

- tye        

Replies are listed 'Best First'.
Re^6: "require Carp" may be hazardous to your code (assume)
by ikegami (Patriarch) on Dec 05, 2006 at 21:17 UTC

    Nice catch. I thought it was a bit fast...

    Without heavy bits: 1.34 ms

    >perl -le "$t1=time; for (1..$ARGV[0]) { delete $INC{'Carp.pm'}; requi +re Carp; } $t2=time; print(($t2-$t1)/$ARGV[0])" 100000 0.00134 >perl -le "$t1=time; for (1..$ARGV[0]) { delete $INC{'Carp.pm'}; requi +re Carp; } $t2=time; print(($t2-$t1)/$ARGV[0])" 100000 0.00134 >perl -le "$t1=time; for (1..$ARGV[0]) { delete $INC{'Carp.pm'}; requi +re Carp; } $t2=time; print(($t2-$t1)/$ARGV[0])" 100000 0.00134

    With heavy bits: 4.75 ms

    >perl -le "$t1=time; for (1..$ARGV[0]) { delete $INC{'Carp.pm'}; delet +e $INC{'Carp/Heavy.pm'}; require Carp; require Carp::Heavy; } $t2=tim +e; print(($t2-$t1)/$ARGV[0])" 100000 0.00475 >perl -le "$t1=time; for (1..$ARGV[0]) { delete $INC{'Carp.pm'}; delet +e $INC{'Carp/Heavy.pm'}; require Carp; require Carp::Heavy; } $t2=tim +e; print(($t2-$t1)/$ARGV[0])" 100000 0.00474

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2025-07-20 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.