← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:06 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/5.22.0/x86_64-linux/attributes.pm
StatementsExecuted 273 statements in 936µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
14144244µs1.28msattributes::::importattributes::import
141183µs110µsattributes::::_modify_attrs_and_deprecateattributes::_modify_attrs_and_deprecate
262113µs13µsattributes::::CORE:matchattributes::CORE:match (opcode)
131113µs13µsattributes::::CORE:regcompattributes::CORE:regcomp (opcode)
14119µs9µsattributes::::reftypeattributes::reftype (xsub)
14119µs9µsattributes::::_modify_attrsattributes::_modify_attrs (xsub)
1119µs10µsattributes::::BEGIN@9attributes::BEGIN@9
2213µs3µsattributes::::CORE:qrattributes::CORE:qr (opcode)
0000s0sattributes::::carpattributes::carp
0000s0sattributes::::croakattributes::croak
0000s0sattributes::::getattributes::get
0000s0sattributes::::require_versionattributes::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 attributes;
2
31300nsour $VERSION = 0.27;
4
51700ns@EXPORT_OK = qw(get reftype);
61100ns@EXPORT = ();
712µs%EXPORT_TAGS = (ALL => [@EXPORT, @EXPORT_OK]);
8
92400µs212µs
# spent 10µs (9+1) within attributes::BEGIN@9 which was called: # once (9µs+1µs) by Attribute::Handlers::BEGIN@114 at line 9
use strict;
# spent 10µs making 1 call to attributes::BEGIN@9 # spent 2µs making 1 call to strict::import
10
11sub croak {
12 require Carp;
13 goto &Carp::croak;
14}
15
16sub carp {
17 require Carp;
18 goto &Carp::carp;
19}
20
211200nsmy %deprecated;
2217µs12µs$deprecated{CODE} = qr/\A-?(locked)\z/;
# spent 2µs making 1 call to attributes::CORE:qr
23$deprecated{ARRAY} = $deprecated{HASH} = $deprecated{SCALAR}
2412µs1400ns = qr/\A-?(unique)\z/;
# spent 400ns making 1 call to attributes::CORE:qr
25
2612µsmy %msg = (
27 lvalue => 'lvalue attribute applied to already-defined subroutine',
28 -lvalue => 'lvalue attribute removed from already-defined subroutine',
29 const => 'Useless use of attribute "const"',
30);
31
32
# spent 110µs (83+27) within attributes::_modify_attrs_and_deprecate which was called 14 times, avg 8µs/call: # 14 times (83µs+27µs) by attributes::import at line 67, avg 8µs/call
sub _modify_attrs_and_deprecate {
33144µs my $svtype = shift;
34 # Now that we've removed handling of locked from the XS code, we need to
35 # remove it here, else it ends up in @badattrs. (If we do the deprecation in
36 # XS, we can't control the warning based on *our* caller's lexical settings,
37 # and the warned line is in this package)
38 grep {
391454µs149µs $deprecated{$svtype} && /$deprecated{$svtype}/ ? do {
# spent 9µs making 14 calls to attributes::_modify_attrs, avg 657ns/call
40 require warnings;
41 warnings::warnif('deprecated', "Attribute \"$1\" is deprecated");
42 0;
431359µs2618µs } : $svtype eq 'CODE' && exists $msg{$_} ? do {
# spent 13µs making 13 calls to attributes::CORE:regcomp, avg 977ns/call # spent 5µs making 13 calls to attributes::CORE:match, avg 377ns/call
44 require warnings;
45 warnings::warnif(
46 'misc',
47 $msg{$_}
48 );
49 0;
50 } : 1
51 } _modify_attrs(@_);
52}
53
54
# spent 1.28ms (244µs+1.04) within attributes::import which was called 14 times, avg 92µs/call: # once (18µs+136µs) by App::Rad::Help::BEGIN@59 at line 59 of App/Rad/Help.pm # once (22µs+114µs) by main::BEGIN@229 at line 229 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (21µs+96µs) by Attribute::Handlers::BEGIN@114 at line 114 of Attribute/Handlers.pm # once (16µs+75µs) by main::BEGIN@237 at line 237 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (13µs+72µs) by main::BEGIN@277 at line 277 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (15µs+66µs) by main::BEGIN@253 at line 253 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (13µs+66µs) by main::BEGIN@245 at line 245 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (53µs+27µs) by DynaLoader::BEGIN@94 at line 94 of XSLoader.pm # once (12µs+66µs) by main::BEGIN@304 at line 304 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (12µs+65µs) by main::BEGIN@286 at line 286 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (12µs+65µs) by main::BEGIN@312 at line 312 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (12µs+64µs) by main::BEGIN@269 at line 269 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (12µs+64µs) by main::BEGIN@295 at line 295 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage # once (13µs+63µs) by main::BEGIN@261 at line 261 of /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
sub import {
55149µs @_ > 2 && ref $_[2] or do {
56 require Exporter;
57 goto &Exporter::import;
58 };
591412µs my (undef,$home_stash,$svref,@attrs) = @_;
60
611442µs149µs my $svtype = uc reftype($svref);
# spent 9µs making 14 calls to attributes::reftype, avg 664ns/call
62141µs my $pkgmeth;
631452µs1423µs $pkgmeth = UNIVERSAL::can($home_stash, "MODIFY_${svtype}_ATTRIBUTES")
# spent 23µs making 14 calls to UNIVERSAL::can, avg 2µs/call
64 if defined $home_stash && $home_stash ne '';
651423µs my @badattrs;
66146µs if ($pkgmeth) {
671416µs14110µs my @pkgattrs = _modify_attrs_and_deprecate($svtype, $svref, @attrs);
# spent 110µs making 14 calls to attributes::_modify_attrs_and_deprecate, avg 8µs/call
681418µs14340µs @badattrs = $pkgmeth->($home_stash, $svref, @pkgattrs);
# spent 337µs making 13 calls to Attribute::Handlers::__ANON__[Attribute/Handlers.pm:199], avg 26µs/call # spent 2µs making 1 call to Attribute::Handlers::_TEST_::MODIFY_CODE_ATTRIBUTES
69148µs if (!@badattrs && @pkgattrs) {
70134µs require warnings;
711310µs13548µs return unless warnings::enabled('reserved');
# spent 548µs making 13 calls to warnings::enabled, avg 42µs/call
722634µs138µs @pkgattrs = grep { m/\A[[:lower:]]+(?:\z|\()/ } @pkgattrs;
# spent 8µs making 13 calls to attributes::CORE:match, avg 646ns/call
73132µs if (@pkgattrs) {
74 for my $attr (@pkgattrs) {
75 $attr =~ s/\(.+\z//s;
76 }
77 my $s = ((@pkgattrs == 1) ? '' : 's');
78 carp "$svtype package attribute$s " .
79 "may clash with future reserved word$s: " .
80 join(' : ' , @pkgattrs);
81 }
82 }
83 }
84 else {
85 @badattrs = _modify_attrs_and_deprecate($svtype, $svref, @attrs);
86 }
871431µs if (@badattrs) {
88 croak "Invalid $svtype attribute" .
89 (( @badattrs == 1 ) ? '' : 's') .
90 ": " .
91 join(' : ', @badattrs);
92 }
93}
94
95sub get ($) {
96 @_ == 1 && ref $_[0] or
97 croak 'Usage: '.__PACKAGE__.'::get $ref';
98 my $svref = shift;
99 my $svtype = uc reftype($svref);
100 my $stash = _guess_stash($svref);
101 $stash = caller unless defined $stash;
102 my $pkgmeth;
103 $pkgmeth = UNIVERSAL::can($stash, "FETCH_${svtype}_ATTRIBUTES")
104 if defined $stash && $stash ne '';
105 return $pkgmeth ?
106 (_fetch_attrs($svref), $pkgmeth->($stash, $svref)) :
107 (_fetch_attrs($svref))
108 ;
109}
110
111sub require_version { goto &UNIVERSAL::VERSION }
112
1131400nsrequire XSLoader;
1141130µs1124µsXSLoader::load();
# spent 124µs making 1 call to XSLoader::load
115
11616µs1;
117__END__
 
# spent 13µs within attributes::CORE:match which was called 26 times, avg 512ns/call: # 13 times (8µs+0s) by attributes::import at line 72, avg 646ns/call # 13 times (5µs+0s) by attributes::_modify_attrs_and_deprecate at line 43, avg 377ns/call
sub attributes::CORE:match; # opcode
# spent 3µs within attributes::CORE:qr which was called 2 times, avg 1µs/call: # once (2µs+0s) by Attribute::Handlers::BEGIN@114 at line 22 # once (400ns+0s) by Attribute::Handlers::BEGIN@114 at line 24
sub attributes::CORE:qr; # opcode
# spent 13µs within attributes::CORE:regcomp which was called 13 times, avg 977ns/call: # 13 times (13µs+0s) by attributes::_modify_attrs_and_deprecate at line 43, avg 977ns/call
sub attributes::CORE:regcomp; # opcode
# spent 9µs within attributes::_modify_attrs which was called 14 times, avg 657ns/call: # 14 times (9µs+0s) by attributes::_modify_attrs_and_deprecate at line 39, avg 657ns/call
sub attributes::_modify_attrs; # xsub
# spent 9µs within attributes::reftype which was called 14 times, avg 664ns/call: # 14 times (9µs+0s) by attributes::import at line 61, avg 664ns/call
sub attributes::reftype; # xsub