Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
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 learning in the Monastery: (6)
As of 2024-04-24 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found