← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:23:07 2010

File /usr/local/lib/perl5/5.10.1/if.pm
Statements Executed 30
Statement Execution Time 80µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
31137µs46µsif::::workif::work
33213µs13µsif::::importif::import
2126µs6µsif::::CORE:substif::CORE:subst (opcode)
0000s0sif::::unimportif::unimport
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package if;
2
31500ns$VERSION = '0.05';
4
5
# spent 46µs (37+9) within if::work which was called 3 times, avg 15µs/call: # 3 times (37µs+9µs) by Class::ISA::BEGIN@8 or Moose::Object::BEGIN@12 or Moose::Object::BEGIN@13 at line 18, avg 15µs/call
sub work {
632µs my $method = shift() ? 'import' : 'unimport';
732µs die "Too few arguments to `use if' (some code returning an empty list in list context?)"
8 unless @_ >= 2;
935µs return unless shift; # CONDITION
10
112500ns my $p = $_[0]; # PACKAGE
12212µs26µs (my $file = "$p.pm") =~ s!::!/!g;
# spent 6µs making 2 calls to if::CORE:subst, avg 3µs/call
132900ns require $file; # Works even if $_[0] is a keyword (like open)
14222µs23µs my $m = $p->can($method);
# spent 3µs making 2 calls to UNIVERSAL::can, avg 2µs/call
1528µs11.10ms goto &$m if $m;
# spent 1.10ms making 1 call to metaclass::import
16}
17
18924µs346µs
# spent 13µs within if::import which was called 3 times, avg 4µs/call: # once (6µs+0s) by Class::ISA::BEGIN@8 at line 8 of Class/ISA.pm # once (4µs+0s) by Moose::Object::BEGIN@12 at line 12 of Moose/Object.pm # once (3µs+0s) by Moose::Object::BEGIN@13 at line 13 of Moose/Object.pm
sub import { shift; unshift @_, 1; goto &work }
# spent 46µs making 3 calls to if::work, avg 15µs/call
19sub unimport { shift; unshift @_, 0; goto &work }
20
2113µs1;
22__END__
23
24=head1 NAME
25
26if - C<use> a Perl module if a condition holds
27
28=head1 SYNOPSIS
29
30 use if CONDITION, MODULE => ARGUMENTS;
31
32=head1 DESCRIPTION
33
34The construct
35
36 use if CONDITION, MODULE => ARGUMENTS;
37
38has no effect unless C<CONDITION> is true. In this case the effect is
39the same as of
40
41 use MODULE ARGUMENTS;
42
43Above C<< => >> provides necessary quoting of C<MODULE>. If not used (e.g.,
44no ARGUMENTS to give), you'd better quote C<MODULE> yourselves.
45
46=head1 BUGS
47
48The current implementation does not allow specification of the
49required version of the module.
50
51=head1 AUTHOR
52
53Ilya Zakharevich L<mailto:perl-module-if@ilyaz.org>.
54
55=cut
56
# spent 6µs within if::CORE:subst which was called 2 times, avg 3µs/call: # 2 times (6µs+0s) by if::work at line 12 of if.pm, avg 3µs/call
sub if::CORE:subst; # xsub