Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^6: Use 'use' in foreach

by stevieb (Canon)
on Jul 19, 2017 at 13:57 UTC ( [id://1195467]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Use 'use' in foreach
in thread Use 'use' in foreach

I don't know if this actually performs a valid comparison, but:

use warnings; use strict; use Benchmark qw(timethese); use Module::Load; BEGIN { timethese( 1000000000, { my_use => sub { use Data::Dumper; }, my_check => sub { load Data::Dumper if ! $Data::Dumper::VERSION; } } ); }

Output:

perl bench_use.pl Benchmark: timing 1000000000 iterations of my_check, my_use... my_check: 24 wallclock secs (27.21 usr + -0.09 sys = 27.12 CPU) @ 36 +873156.34/s (n=1000000000) my_use: -3 wallclock secs ( 0.92 usr + 0.33 sys = 1.25 CPU) @ 800 +000000.00/s (n=1000000000)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-16 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found