Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/if.pm |
Statements | Executed 41 statements in 137µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4 | 1 | 1 | 370µs | 410µs | work | if::
4 | 4 | 4 | 12µs | 12µs | import | if::
3 | 1 | 1 | 2µs | 2µs | CORE:subst (opcode) | if::
0 | 0 | 0 | 0s | 0s | unimport | if::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package if; | ||||
2 | |||||
3 | 1 | 500ns | $VERSION = '0.0602'; | ||
4 | |||||
5 | # spent 410µs (370+40) within if::work which was called 4 times, avg 102µs/call:
# 4 times (370µs+40µs) by Devel::InnerPackage::BEGIN@7 or Module::Pluggable::BEGIN@7 or Module::Pluggable::Object::BEGIN@11 or flock::BEGIN@109 at line 18, avg 102µs/call | ||||
6 | 4 | 2µs | my $method = shift() ? 'import' : 'unimport'; | ||
7 | 4 | 2µs | die "Too few arguments to 'use if' (some code returning an empty list in list context?)" | ||
8 | unless @_ >= 2; | ||||
9 | 4 | 4µs | return unless shift; # CONDITION | ||
10 | |||||
11 | 3 | 600ns | my $p = $_[0]; # PACKAGE | ||
12 | 3 | 11µs | 3 | 2µs | (my $file = "$p.pm") =~ s!::!/!g; # spent 2µs making 3 calls to if::CORE:subst, avg 667ns/call |
13 | 3 | 57µs | require $file; # Works even if $_[0] is a keyword (like open) | ||
14 | 3 | 17µs | 3 | 4µs | my $m = $p->can($method); # spent 4µs making 3 calls to UNIVERSAL::can, avg 1µs/call |
15 | 3 | 14µs | 3 | 261µs | goto &$m if $m; # spent 261µs making 3 calls to deprecate::import, avg 87µs/call |
16 | } | ||||
17 | |||||
18 | 12 | 27µs | 4 | 410µs | # spent 12µs within if::import which was called 4 times, avg 3µs/call:
# once (4µs+0s) by flock::BEGIN@109 at line 109 of Path/Tiny.pm
# once (3µs+0s) by Devel::InnerPackage::BEGIN@7 at line 7 of Devel/InnerPackage.pm
# once (3µs+0s) by Module::Pluggable::BEGIN@7 at line 7 of Module/Pluggable.pm
# once (2µs+0s) by Module::Pluggable::Object::BEGIN@11 at line 11 of Module/Pluggable/Object.pm # spent 410µs making 4 calls to if::work, avg 102µs/call |
19 | sub unimport { shift; unshift @_, 0; goto &work } | ||||
20 | |||||
21 | 1 | 2µs | 1; | ||
22 | __END__ | ||||
# spent 2µs within if::CORE:subst which was called 3 times, avg 667ns/call:
# 3 times (2µs+0s) by if::work at line 12, avg 667ns/call |