Profile of aliased.pm

← Index
NYTProf Performance Profile «line view»
For t/optimization.t
Run on Thu Jan 8 22:47:42 2015
Reported on Thu Jan 8 22:48:05 2015

Filename | /home/ss5/perl5/perlbrew/perls/tapper-perl/lib/site_perl/5.16.3/aliased.pm
Statements | Executed 115 statements in 1000µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
5 | 1 | 1 | 245µs | 50.0ms | aliased::::_load_aliasaliased::_load_alias (recurses: max depth 1, inclusive time 426µs)
5 | 1 | 1 | 96µs | 168µs | aliased::::_make_aliasaliased::_make_alias
5 | 5 | 2 | 55µs | 50.2ms | aliased::::importaliased::import (recurses: max depth 1, inclusive time 491µs)
5 | 1 | 1 | 53µs | 69µs | aliased::::_get_aliasaliased::_get_alias
5 | 1 | 1 | 16µs | 16µs | aliased::::CORE:substaliased::CORE:subst (opcode)
1 | 1 | 1 | 16µs | 33µs | aliased::::BEGIN@10aliased::BEGIN@10
1 | 1 | 1 | 12µs | 26µs | aliased::::BEGIN@45aliased::BEGIN@45
5 | 1 | 1 | 4µs | 4µs | aliased::::CORE:matchaliased::CORE:match (opcode)
0 | 0 | 0 | 0s | 0s | aliased::::__ANON__[:46]aliased::__ANON__[:46]
0 | 0 | 0 | 0s | 0s | aliased::::__ANON__[:95]aliased::__ANON__[:95]
0 | 0 | 0 | 0s | 0s | aliased::::_croakaliased::_croak
0 | 0 | 0 | 0s | 0s | aliased::::aliasaliased::alias
0 | 0 | 0 | 0s | 0s | aliased::::prefixaliased::prefix

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package aliased;
2 |  |  |  |  |
3 | 1 | 600ns |  |  | our $VERSION = '0.31';
4 | 1 | 16µs |  |  | $VERSION = eval $VERSION; # spent 2µs executing statements in string eval
5 |  |  |  |  |
6 | 1 | 500ns |  |  | require Exporter;
7 | 1 | 8µs |  |  | @ISA = qw(Exporter);
8 | 1 | 1µs |  |  | @EXPORT = qw(alias prefix);
9 |  |  |  |  |
10 | 2 | 239µs | 2 | 50µs | # spent 33µs (16+17) within aliased::BEGIN@10 which was called: # once (16µs+17µs) by Data::DPath::Path::BEGIN@8 at line 10 use strict; # spent 33µs making 1 call to aliased::BEGIN@10 # spent 17µs making 1 call to strict::import
11 |  |  |  |  |
12 |  |  |  |  | sub _croak {
13 |  |  |  |  | require Carp;
14 |  |  |  |  | Carp::croak(@_);
15 |  |  |  |  | }
16 |  |  |  |  |
17 |  |  |  |  | # spent 50.2ms (55µs+50.1) within aliased::import which was called 5 times, avg 10.0ms/call: # once (12µs+46.5ms) by Data::DPath::Path::BEGIN@10 at line 10 of lib/Data/DPath/Path.pm # once (14µs+3.05ms) by Data::DPath::Path::BEGIN@8 at line 8 of lib/Data/DPath/Path.pm # once (10µs+532µs) by Data::DPath::Path::BEGIN@9 at line 9 of lib/Data/DPath/Path.pm # once (11µs+-11µs) by Data::DPath::Context::BEGIN@8 at line 8 of lib/Data/DPath/Context.pm # once (9µs+-9µs) by Data::DPath::Context::BEGIN@9 at line 9 of lib/Data/DPath/Context.pm sub import {
18 | 5 | 7µs |  |  | my ( $class, $package, $alias, @import ) = @_;
19 |  |  |  |  |
20 | 5 | 2µs |  |  | if ( @_ <= 1 ) {
21 |  |  |  |  | $class->export_to_level(1);
22 |  |  |  |  | return;
23 |  |  |  |  | }
24 |  |  |  |  |
25 | 5 | 4µs |  |  | my $callpack = caller(0);
26 | 5 | 8µs | 5 | 50.0ms | _load_alias( $package, $callpack, @import ); # spent 50.4ms making 5 calls to aliased::_load_alias, avg 10.1ms/call, recursion: max depth 1, sum of overlapping time 426µs
27 | 5 | 30µs | 5 | 168µs | _make_alias( $package, $callpack, $alias ); # spent 168µs making 5 calls to aliased::_make_alias, avg 34µs/call
28 |  |  |  |  | }
29 |  |  |  |  |
30 |  |  |  |  | # spent 69µs (53+16) within aliased::_get_alias which was called 5 times, avg 14µs/call: # 5 times (53µs+16µs) by aliased::_make_alias at line 39, avg 14µs/call sub _get_alias {
31 | 5 | 2µs |  |  | my $package = shift;
32 | 5 | 58µs | 5 | 16µs | $package =~ s/.*(?:::|')//; # spent 16µs making 5 calls to aliased::CORE:subst, avg 3µs/call
33 | 5 | 20µs |  |  | return $package;
34 |  |  |  |  | }
35 |  |  |  |  |
36 |  |  |  |  | # spent 168µs (96+73) within aliased::_make_alias which was called 5 times, avg 34µs/call: # 5 times (96µs+73µs) by aliased::import at line 27, avg 34µs/call sub _make_alias {
37 | 5 | 5µs |  |  | my ( $package, $callpack, $alias ) = @_;
38 |  |  |  |  |
39 | 5 | 8µs | 5 | 69µs | $alias ||= _get_alias($package); # spent 69µs making 5 calls to aliased::_get_alias, avg 14µs/call
40 |  |  |  |  |
41 | 5 | 22µs | 5 | 4µs | my $destination = $alias =~ /::/ # spent 4µs making 5 calls to aliased::CORE:match, avg 740ns/call
42 |  |  |  |  | ? $alias
43 |  |  |  |  | : "$callpack\::$alias";
44 |  |  |  |  |
45 | 2 | 286µs | 2 | 41µs | # spent 26µs (12+15) within aliased::BEGIN@45 which was called: # once (12µs+15µs) by Data::DPath::Path::BEGIN@8 at line 45 no strict 'refs'; # spent 26µs making 1 call to aliased::BEGIN@45 # spent 14µs making 1 call to strict::unimport
46 | 5 | 57µs |  |  | *{ $destination } = sub () { $package };
47 |  |  |  |  | }
48 |  |  |  |  |
49 |  |  |  |  | # spent 50.0ms (245µs+49.8) within aliased::_load_alias which was called 5 times, avg 10.0ms/call: # 5 times (245µs+49.8ms) by aliased::import at line 26, avg 10.0ms/call sub _load_alias {
50 | 5 | 4µs |  |  | my ( $package, $callpack, @import ) = @_;
51 |  |  |  |  |
52 |  |  |  |  | # We don't localize $SIG{__DIE__} here because we need to be careful about
53 |  |  |  |  | # restoring its value if there is a failure. Very, very tricky.
54 | 5 | 6µs |  |  | my $sigdie = $SIG{__DIE__};
55 |  |  |  |  | {
56 | 10 | 10µs |  |  | my $code =
57 |  |  |  |  | @import == 0
58 |  |  |  |  | ? "package $callpack; use $package;"
59 |  |  |  |  | : "package $callpack; use $package (\@import)";
60 | 5 | 168µs |  |  | eval $code; # spent 99µs executing statements in string eval # includes 2.82ms spent executing 1 call to 1 sub defined therein. # spent 79µs executing statements in string eval # includes 142µs spent executing 1 call to 1 sub defined therein. # spent 76µs executing statements in string eval # includes 133µs spent executing 1 call to 1 sub defined therein. # spent 74µs executing statements in string eval # includes 138µs spent executing 1 call to 1 sub defined therein. # spent 19µs executing statements in string eval # includes 11µs spent executing 1 call to 1 sub defined therein.
61 | 5 | 3µs |  |  | if ( my $error = $@ ) {
62 |  |  |  |  | $SIG{__DIE__} = $sigdie;
63 |  |  |  |  | _croak($error);
64 |  |  |  |  | }
65 | 5 | 8µs |  |  | $sigdie = $SIG{__DIE__}
66 |  |  |  |  | if defined $SIG{__DIE__};
67 |  |  |  |  | }
68 |  |  |  |  |
69 |  |  |  |  | # Make sure a global $SIG{__DIE__} makes it out of the localization.
70 | 5 | 1µs |  |  | $SIG{__DIE__} = $sigdie if defined $sigdie;
71 | 5 | 19µs |  |  | return $package;
72 |  |  |  |  | }
73 |  |  |  |  |
74 |  |  |  |  | sub alias {
75 |  |  |  |  | my ( $package, @import ) = @_;
76 |  |  |  |  |
77 |  |  |  |  | my $callpack = scalar caller(0);
78 |  |  |  |  | return _load_alias( $package, $callpack, @import );
79 |  |  |  |  | }
80 |  |  |  |  |
81 |  |  |  |  | sub prefix {
82 |  |  |  |  | my ($class) = @_;
83 |  |  |  |  | return sub {
84 |  |  |  |  | my ($name) = @_;
85 |  |  |  |  | my $callpack = caller(0);
86 |  |  |  |  | if ( not @_ ) {
87 |  |  |  |  | return _load_alias( $class, $callpack );
88 |  |  |  |  | }
89 |  |  |  |  | elsif ( @_ == 1 && defined $name ) {
90 |  |  |  |  | return _load_alias( "${class}::$name", $callpack );
91 |  |  |  |  | }
92 |  |  |  |  | else {
93 |  |  |  |  | _croak("Too many arguments to prefix('$class')");
94 |  |  |  |  | }
95 |  |  |  |  | };
96 |  |  |  |  | }
97 |  |  |  |  |
98 | 1 | 5µs |  |  | 1;
99 |  |  |  |  | __END__
|  |  |  |  | # spent 4µs within aliased::CORE:match which was called 5 times, avg 740ns/call: # 5 times (4µs+0s) by aliased::_make_alias at line 41, avg 740ns/call sub aliased::CORE:match; # opcode
|  |  |  |  | # spent 16µs within aliased::CORE:subst which was called 5 times, avg 3µs/call: # 5 times (16µs+0s) by aliased::_get_alias at line 32, avg 3µs/call sub aliased::CORE:subst; # opcode