← Index
NYTProf Performance Profile   « block view • line view • sub view »
For ./testnewboardincnply
  Run on Mon Jan 12 21:52:27 2015
Reported on Mon Jan 12 22:01:18 2015

Filename/usr/share/perl/5.14/Exporter.pm
StatementsExecuted 327 statements in 632µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.08ms1.11msExporter::::as_heavyExporter::as_heavy
212110473µs1.65msExporter::::importExporter::import
192115µs15µsExporter::::CORE:matchExporter::CORE:match (opcode)
11219µs9µsExporter::::CORE:substExporter::CORE:subst (opcode)
1114µs1.12msExporter::::exportExporter::export
0000s0sExporter::::__ANON__[:65]Exporter::__ANON__[:65]
0000s0sExporter::::export_failExporter::export_fail
0000s0sExporter::::export_ok_tagsExporter::export_ok_tags
0000s0sExporter::::export_tagsExporter::export_tags
0000s0sExporter::::export_to_levelExporter::export_to_level
0000s0sExporter::::require_versionExporter::require_version
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Exporter;
2
3125µsrequire 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
91400nsour $Debug = 0;
101200nsour $ExportLevel = 0;
111500nsour $Verbose ||= 0;
121500nsour $VERSION = '5.64_03';
131300nsour (%Cache);
14
15
# spent 1.11ms (1.08+38µs) within Exporter::as_heavy which was called: # once (1.08ms+38µs) by Exporter::export at line 25
sub as_heavy {
16160µs require Exporter::Heavy;
17 # Unfortunately, this does not work if the caller is aliased as *name = \&foo
18 # Thus the need to create a lot of identical subroutines
1912µs my $c = (caller(1))[3];
2015µs13µs $c =~ s/.*:://;
# spent 3µs making 1 call to Exporter::CORE:subst
2114µs \&{"Exporter::Heavy::heavy_$c"};
22}
23
24
# spent 1.12ms (4µs+1.11) within Exporter::export which was called: # once (4µs+1.11ms) by Exporter::import at line 63
sub export {
2515µs21.15ms goto &{as_heavy()};
# spent 1.11ms making 1 call to Exporter::as_heavy # spent 41µs making 1 call to Exporter::Heavy::heavy_export
26}
27
28
# spent 1.65ms (473µs+1.18) within Exporter::import which was called 21 times, avg 79µs/call: # once (13µs+1.16ms) by Getopt::Long::import at line 113 of Getopt/Long.pm # once (140µs+6µs) by Function::Parameters::BEGIN@7 at line 7 of Function/Parameters.pm # once (35µs+2µs) by NewBoard::BEGIN@25 at line 25 of NewBoard.pm # once (32µs+2µs) by NewBoard::BEGIN@24 at line 24 of NewBoard.pm # once (29µs+1µs) by Tuple::BEGIN@5 at line 5 of /homes/dcw/lib/perl5/DCW/Tuple.pm # once (23µs+1µs) by Data::Dumper::BEGIN@20 at line 20 of Data/Dumper.pm # once (23µs+1µs) by Clone::BEGIN@5 at line 5 of Clone.pm # once (17µs+700ns) by main::BEGIN@9 at line 9 of testnewboardincnply # once (17µs+800ns) by NewBoard::BEGIN@19 at line 19 of NewBoard.pm # once (16µs+700ns) by main::BEGIN@15 at line 15 of NewIncNPlyPicker.pm # once (15µs+600ns) by main::BEGIN@18 at line 18 of NewIncNPlyPicker.pm # once (15µs+700ns) by main::BEGIN@7.9 at line 7 of NewSolveGame.pm # once (14µs+700ns) by main::BEGIN@10.11 at line 10 of NewSolveGame.pm # once (14µs+0s) by main::BEGIN@12 at line 12 of testnewboardincnply # once (13µs+600ns) by main::BEGIN@19 at line 19 of NewIncNPlyPicker.pm # once (13µs+0s) by Getopt::Long::BEGIN@25 at line 25 of Getopt/Long.pm # once (12µs+500ns) by main::BEGIN@11 at line 11 of NewSolveGame.pm # once (9µs+0s) by main::BEGIN@22 at line 22 of NewIncNPlyPicker.pm # once (9µs+0s) by main::BEGIN@14.13 at line 14 of NewSolveGame.pm # once (6µs+0s) by List::BEGIN@15 at line 15 of /homes/dcw/lib/perl5/DCW/List.pm # once (6µs+0s) by Tuple::BEGIN@13 at line 13 of /homes/dcw/lib/perl5/DCW/Tuple.pm
sub import {
29217µs my $pkg = shift;
30218µs my $callpkg = caller($ExportLevel);
31
32217µs if ($pkg eq "Exporter" and @_ and $_[0] eq "import") {
3325µs *{$callpkg."::import"} = \&import;
3428µs return;
35 }
36
37 # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-(
381926µs my $exports = \@{"$pkg\::EXPORT"};
39 # But, avoid creating things if they don't exist, which saves a couple of
40 # hundred bytes per package processed.
411916µs my $fail = ${$pkg . '::'}{EXPORT_FAIL} && \@{"$pkg\::EXPORT_FAIL"};
421911µs return export $pkg, $callpkg, @_
43 if $Verbose or $Debug or $fail && @$fail > 1;
441911µs my $export_cache = ($Cache{$pkg} ||= {});
451912µs my $args = @_ or @_ = @$exports;
46
47194µs local $_;
481938µs if ($args and not %$export_cache) {
49 s/^&//, $export_cache->{$_} = 1
50358µs106µs foreach (@$exports, @{"$pkg\::EXPORT_OK"});
# spent 6µs making 10 calls to Exporter::CORE:subst, avg 600ns/call
51 }
52192µs my $heavy;
53 # Try very hard not to use {} and hence have to enter scope on the foreach
54 # We bomb out of the loop with last as soon as heavy is set.
55198µs if ($args or $fail) {
56 ($heavy = (/\W/ or $args and not exists $export_cache->{$_}
57 or $fail and @$fail and $_ eq $fail->[0])) and last
58950µs139µs foreach (@_);
# spent 9µs making 13 calls to Exporter::CORE:match, avg 708ns/call
59 } else {
60 ($heavy = /\W/) and last
611028µs65µs foreach (@_);
# spent 5µs making 6 calls to Exporter::CORE:match, avg 900ns/call
62 }
63195µs11.12ms return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
# spent 1.12ms making 1 call to Exporter::export
64 local $SIG{__WARN__} =
651888µs sub {require Carp; &Carp::carp} if not $SIG{__WARN__};
66 # shortcut for the common case of no type character
6718129µs *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
68}
69
70# Default methods
71
72sub export_fail {
73 my $self = shift;
74 @_;
75}
76
77# Unfortunately, caller(1)[3] "does not work" if the caller is aliased as
78# *name = \&foo. Thus the need to create a lot of identical subroutines
79# Otherwise we could have aliased them to export().
80
81sub export_to_level {
82 goto &{as_heavy()};
83}
84
85sub export_tags {
86 goto &{as_heavy()};
87}
88
89sub export_ok_tags {
90 goto &{as_heavy()};
91}
92
93sub require_version {
94 goto &{as_heavy()};
95}
96
9718µs1;
98__END__
 
# spent 15µs within Exporter::CORE:match which was called 19 times, avg 768ns/call: # 13 times (9µs+0s) by Exporter::import at line 58, avg 708ns/call # 6 times (5µs+0s) by Exporter::import at line 61, avg 900ns/call
sub Exporter::CORE:match; # opcode
# spent 9µs within Exporter::CORE:subst which was called 11 times, avg 791ns/call: # 10 times (6µs+0s) by Exporter::import at line 50, avg 600ns/call # once (3µs+0s) by Exporter::as_heavy at line 20
sub Exporter::CORE:subst; # opcode