Filename | /usr/share/perl/5.36/if.pm |
Statements | Executed 43 statements in 442µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4 | 2 | 1 | 22µs | 26µs | work | if::
1 | 1 | 1 | 7µs | 8µs | BEGIN@2 | if::
3 | 3 | 2 | 4µs | 4µs | unimport | if::
1 | 1 | 1 | 2µs | 2µs | import | if::
3 | 1 | 1 | 2µs | 2µs | CORE:subst (opcode) | if::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package if; | ||||
2 | 2 | 125µs | 2 | 10µs | # spent 8µs (7+2) within if::BEGIN@2 which was called:
# once (7µs+2µs) by IO::Prompter::BEGIN@6 at line 2 # spent 8µs making 1 call to if::BEGIN@2
# spent 2µs making 1 call to strict::import |
3 | 1 | 200ns | our $VERSION = '0.0610'; | ||
4 | |||||
5 | sub work { | ||||
6 | 4 | 2µs | my $method = shift() ? 'import' : 'unimport'; | ||
7 | 4 | 1µs | unless (@_ >= 2) { | ||
8 | my $type = ($method eq 'import') ? 'use' : 'no'; | ||||
9 | die "Too few arguments to '$type if' (some code returning an empty list in list context?)" | ||||
10 | } | ||||
11 | 4 | 2µs | return unless shift; # CONDITION | ||
12 | |||||
13 | 3 | 700ns | my $p = $_[0]; # PACKAGE | ||
14 | 3 | 6µs | 3 | 2µs | (my $file = "$p.pm") =~ s!::!/!g; # spent 2µs making 3 calls to if::CORE:subst, avg 600ns/call |
15 | 3 | 600ns | require $file; # Works even if $_[0] is a keyword (like open) | ||
16 | 3 | 11µs | 3 | 3µs | my $m = $p->can($method); # spent 3µs making 3 calls to UNIVERSAL::can, avg 1µs/call |
17 | 3 | 8µs | 3 | 33µs | goto &$m if $m; # spent 33µs making 3 calls to warnings::unimport, avg 11µs/call |
18 | } | ||||
19 | |||||
20 | 3 | 5µs | 1 | 2µs | # spent 2µs within if::import which was called:
# once (2µs+0s) by Pod::Simple::BlackBox::BEGIN@289 at line 289 of Pod/Simple/BlackBox.pm # spent 2µs making 1 call to if::work |
21 | 9 | 278µs | 3 | 25µs | # spent 4µs within if::unimport which was called 3 times, avg 1µs/call:
# once (2µs+0s) by IO::Prompter::BEGIN@6 at line 6 of IO/Prompter.pm
# once (1µs+0s) by Contextual::Return::BEGIN@246 at line 246 of Contextual/Return.pm
# once (1µs+0s) by Contextual::Return::BEGIN@252 at line 252 of Contextual/Return.pm # spent 25µs making 3 calls to if::work, avg 8µs/call |
22 | |||||
23 | 1 | 2µs | 1; | ||
24 | __END__ | ||||
# spent 2µs within if::CORE:subst which was called 3 times, avg 600ns/call:
# 3 times (2µs+0s) by if::work at line 14, avg 600ns/call |