← 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:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Moo/_Utils.pm
StatementsExecuted 1475 statements in 2.88ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
18933591µs1.63msMoo::_Utils::::_install_coderefMoo::_Utils::_install_coderef
30476420µs420µsMoo::_Utils::::_getglobMoo::_Utils::_getglob
19722290µs786µsMoo::_Utils::::_name_coderefMoo::_Utils::_name_coderef
2821131µs64.0msMoo::_Utils::::_load_moduleMoo::_Utils::_load_module (recurses: max depth 1, inclusive time 13.2ms)
242282µs400µsMoo::_Utils::::_set_loadedMoo::_Utils::_set_loaded
11164µs77µsMoo::_Utils::::BEGIN@23Moo::_Utils::BEGIN@23
253341µs41µsMoo::_Utils::::_getstashMoo::_Utils::_getstash
31126µs520µsMoo::_Utils::::_install_modifierMoo::_Utils::_install_modifier
1119µs1.18msMoo::_Utils::::_maybe_load_moduleMoo::_Utils::_maybe_load_module
1117µs20µsMoo::_Utils::::BEGIN@19Moo::_Utils::BEGIN@19
1116µs11µsMoo::_Utils::::BEGIN@3Moo::_Utils::BEGIN@3
1116µs14µsMoo::_Utils::::BEGIN@89Moo::_Utils::BEGIN@89
1116µs16µsMoo::_Utils::::BEGIN@24Moo::_Utils::BEGIN@24
1115µs29µsMoo::_Utils::::BEGIN@8Moo::_Utils::BEGIN@8
1115µs11µsMoo::_Utils::::BEGIN@120Moo::_Utils::BEGIN@120
1114µs23µsMoo::_Utils::::BEGIN@13Moo::_Utils::BEGIN@13
1114µs22µsMoo::_Utils::::BEGIN@9Moo::_Utils::BEGIN@9
1114µs8µsMoo::_Utils::::BEGIN@96Moo::_Utils::BEGIN@96
1114µs10µsMoo::_Utils::::BEGIN@18Moo::_Utils::BEGIN@18
1113µs8µsMoo::_Utils::::BEGIN@22Moo::_Utils::BEGIN@22
1112µs2µsMoo::_Utils::::BEGIN@21Moo::_Utils::BEGIN@21
0000s0sMoo::_Utils::::_get_linear_isaMoo::_Utils::_get_linear_isa
0000s0sMoo::_Utils::::_unimport_coderefsMoo::_Utils::_unimport_coderefs
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moo::_Utils;
2
3255µs216µs
# spent 11µs (6+5) within Moo::_Utils::BEGIN@3 which was called: # once (6µs+5µs) by Moo::BEGIN@4 at line 3
no warnings 'once'; # guard against -w
# spent 11µs making 1 call to Moo::_Utils::BEGIN@3 # spent 5µs making 1 call to warnings::unimport
4
5304578µs
# spent 420µs within Moo::_Utils::_getglob which was called 304 times, avg 1µs/call: # 189 times (290µs+0s) by Moo::_Utils::_install_coderef at line 88, avg 2µs/call # 54 times (53µs+0s) by Method::Generate::Constructor::current_constructor at line 103 of Method/Generate/Constructor.pm, avg 981ns/call # 17 times (27µs+0s) by Sub::Defer::undefer_sub at line 26 of Sub/Defer.pm, avg 2µs/call # 17 times (9µs+0s) by Sub::Defer::undefer_sub at line 31 of Sub/Defer.pm, avg 541ns/call # 12 times (19µs+0s) by Moo::Role::import at line 81 of Moo/Role.pm, avg 2µs/call # 11 times (18µs+0s) by Moo::_constructor_maker_for at line 180 of Moo.pm, avg 2µs/call # 4 times (5µs+0s) by Method::Generate::BuildAll::buildall_body_for at line 28 of Method/Generate/BuildAll.pm, avg 1µs/call
sub _getglob { \*{$_[0]} }
62553µs
# spent 41µs within Moo::_Utils::_getstash which was called 25 times, avg 2µs/call: # 12 times (21µs+0s) by Moo::Role::import at line 43 of Moo/Role.pm, avg 2µs/call # 12 times (18µs+0s) by Moo::import at line 71 of Moo.pm, avg 2µs/call # once (2µs+0s) by Method::Generate::Constructor::new at line 242 of Method/Generate/Constructor.pm
sub _getstash { \%{"$_[0]::"} }
7
8235µs253µs
# spent 29µs (5+24) within Moo::_Utils::BEGIN@8 which was called: # once (5µs+24µs) by Moo::BEGIN@4 at line 8
use constant lt_5_8_3 => ( $] < 5.008003 or $ENV{MOO_TEST_PRE_583} ) ? 1 : 0;
# spent 29µs making 1 call to Moo::_Utils::BEGIN@8 # spent 24µs making 1 call to constant::import
9
# spent 22µs (4+18) within Moo::_Utils::BEGIN@9 which was called: # once (4µs+18µs) by Moo::BEGIN@4 at line 12
use constant can_haz_subutil => (
10 $INC{"Sub/Util.pm"}
1114µs118µs || ( !$INC{"Sub/Name.pm"} && eval { require Sub::Util } )
# spent 18µs making 1 call to constant::import
12129µs122µs ) && defined &Sub::Util::set_subname;
# spent 22µs making 1 call to Moo::_Utils::BEGIN@9
13
# spent 23µs (4+19) within Moo::_Utils::BEGIN@13 which was called: # once (4µs+19µs) by Moo::BEGIN@4 at line 16
use constant can_haz_subname => (
14 $INC{"Sub/Name.pm"}
1512µs119µs || ( !$INC{"Sub/Util.pm"} && eval { require Sub::Name } )
# spent 19µs making 1 call to constant::import
16114µs123µs ) && defined &Sub::Name::subname;
# spent 23µs making 1 call to Moo::_Utils::BEGIN@13
17
18213µs217µs
# spent 10µs (4+7) within Moo::_Utils::BEGIN@18 which was called: # once (4µs+7µs) by Moo::BEGIN@4 at line 18
use Moo::_strictures;
# spent 10µs making 1 call to Moo::_Utils::BEGIN@18 # spent 7µs making 1 call to Moo::_strictures::import
19213µs234µs
# spent 20µs (7+14) within Moo::_Utils::BEGIN@19 which was called: # once (7µs+14µs) by Moo::BEGIN@4 at line 19
use Module::Runtime qw(use_package_optimistically module_notional_filename);
# spent 20µs making 1 call to Moo::_Utils::BEGIN@19 # spent 14µs making 1 call to Module::Runtime::import
20
21211µs12µs
# spent 2µs within Moo::_Utils::BEGIN@21 which was called: # once (2µs+0s) by Moo::BEGIN@4 at line 21
use Devel::GlobalDestruction ();
# spent 2µs making 1 call to Moo::_Utils::BEGIN@21
22212µs212µs
# spent 8µs (3+4) within Moo::_Utils::BEGIN@22 which was called: # once (3µs+4µs) by Moo::BEGIN@4 at line 22
use Exporter qw(import);
# spent 8µs making 1 call to Moo::_Utils::BEGIN@22 # spent 4µs making 1 call to Exporter::import
23250µs177µs
# spent 77µs (64+14) within Moo::_Utils::BEGIN@23 which was called: # once (64µs+14µs) by Moo::BEGIN@4 at line 23
use Moo::_mro;
# spent 77µs making 1 call to Moo::_Utils::BEGIN@23
242241µs227µs
# spent 16µs (6+11) within Moo::_Utils::BEGIN@24 which was called: # once (6µs+11µs) by Moo::BEGIN@4 at line 24
use Config;
# spent 16µs making 1 call to Moo::_Utils::BEGIN@24 # spent 11µs making 1 call to Config::import
25
2611µsour @EXPORT = qw(
27 _getglob _install_modifier _load_module _maybe_load_module
28 _get_linear_isa _getstash _install_coderef _name_coderef
29 _unimport_coderefs _in_global_destruction _set_loaded
30);
31
32sub _in_global_destruction ();
3312µs*_in_global_destruction = \&Devel::GlobalDestruction::in_global_destruction;
34
35
# spent 520µs (26+494) within Moo::_Utils::_install_modifier which was called 3 times, avg 174µs/call: # 3 times (26µs+494µs) by Moo::Role::_install_single_modifier at line 364 of Moo/Role.pm, avg 174µs/call
sub _install_modifier {
3632µs my ($into, $type, $name, $code) = @_;
37
38311µs34µs if (my $to_modify = $into->can($name)) { # CMM will throw for us if not
# spent 4µs making 3 calls to UNIVERSAL::can, avg 1µs/call
3931µs require Sub::Defer;
4034µs3210µs Sub::Defer::undefer_sub($to_modify);
# spent 210µs making 3 calls to Sub::Defer::undefer_sub, avg 70µs/call
41 }
42
4338µs3280µs Class::Method::Modifiers::install_modifier(@_);
# spent 280µs making 3 calls to Class::Method::Modifiers::install_modifier, avg 94µs/call
44}
45
46our %MAYBE_LOADED;
47
48
# spent 64.0ms (131µs+63.9) within Moo::_Utils::_load_module which was called 28 times, avg 2.29ms/call: # 17 times (96µs+63.7ms) by Moo::Role::apply_roles_to_package at line 259 of Moo/Role.pm, avg 3.75ms/call # 11 times (35µs+209µs) by Moo::Role::apply_single_role_to_package at line 268 of Moo/Role.pm, avg 22µs/call
sub _load_module {
49288µs my $module = $_[0];
502828µs28369µs my $file = module_notional_filename($module);
# spent 369µs making 28 calls to Module::Runtime::module_notional_filename, avg 13µs/call
512825µs2863.7ms use_package_optimistically($module);
# spent 76.7ms making 28 calls to Module::Runtime::use_package_optimistically, avg 2.74ms/call, recursion: max depth 1, sum of overlapping time 13.0ms
52 return 1
532854µs if $INC{$file};
54 my $error = $@ || "Can't locate $file";
55
56 # can't just ->can('can') because a sub-package Foo::Bar::Baz
57 # creates a 'Baz::' key in Foo::Bar's symbol table
58 my $stash = _getstash($module)||{};
59 return 1 if grep +(!ref($_) and *$_{CODE}), values %$stash;
60 return 1
61 if $INC{"Moose.pm"} && Class::MOP::class_of($module)
62 or Mouse::Util->can('find_meta') && Mouse::Util::find_meta($module);
63 die $error;
64}
65
66
# spent 1.18ms (9µs+1.17) within Moo::_Utils::_maybe_load_module which was called: # once (9µs+1.17ms) by Method::Generate::Accessor::BEGIN@11 at line 17 of Method/Generate/Accessor.pm
sub _maybe_load_module {
671500ns my $module = $_[0];
68 return $MAYBE_LOADED{$module}
691600ns if exists $MAYBE_LOADED{$module};
7028µs21.17ms if(! eval { use_package_optimistically($module) }) {
# spent 1.15ms making 1 call to Module::Runtime::use_package_optimistically # spent 14µs making 1 call to Module::Runtime::module_notional_filename
71 warn "$module exists but failed to load with error: $@";
72 }
73 elsif ( $INC{module_notional_filename($module)} ) {
74 return $MAYBE_LOADED{$module} = 1;
75 }
76 return $MAYBE_LOADED{$module} = 0;
77}
78
79
# spent 400µs (82+318) within Moo::_Utils::_set_loaded which was called 24 times, avg 17µs/call: # 12 times (46µs+178µs) by Moo::import at line 23 of Moo.pm, avg 19µs/call # 12 times (35µs+140µs) by Moo::Role::import at line 35 of Moo/Role.pm, avg 15µs/call
sub _set_loaded {
802480µs24318µs $INC{Module::Runtime::module_notional_filename($_[0])} ||= $_[1];
# spent 318µs making 24 calls to Module::Runtime::module_notional_filename, avg 13µs/call
81}
82
83sub _get_linear_isa {
84 return mro::get_linear_isa($_[0]);
85}
86
87
# spent 1.63ms (591µs+1.04) within Moo::_Utils::_install_coderef which was called 189 times, avg 9µs/call: # 72 times (220µs+372µs) by Moo::Role::_install_tracked at line 28 of Moo/Role.pm, avg 8µs/call # 72 times (222µs+370µs) by Moo::_install_tracked at line 17 of Moo.pm, avg 8µs/call # 45 times (150µs+292µs) by Sub::Defer::defer_sub at line 69 of Sub/Defer.pm, avg 10µs/call
sub _install_coderef {
88189208µs3781.04ms my ($glob, $code) = (_getglob($_[0]), _name_coderef(@_));
# spent 745µs making 189 calls to Moo::_Utils::_name_coderef, avg 4µs/call # spent 290µs making 189 calls to Moo::_Utils::_getglob, avg 2µs/call
89223µs221µs
# spent 14µs (6+7) within Moo::_Utils::BEGIN@89 which was called: # once (6µs+7µs) by Moo::BEGIN@4 at line 89
no warnings 'redefine';
# spent 14µs making 1 call to Moo::_Utils::BEGIN@89 # spent 8µs making 1 call to warnings::unimport
90189220µs if (*{$glob}{CODE}) {
91 *{$glob} = $code;
92 }
93 # perl will sometimes warn about mismatched prototypes coming from the
94 # inheritance cache, so disable them if we aren't redefining a sub
95 else {
96295µs212µs
# spent 8µs (4+4) within Moo::_Utils::BEGIN@96 which was called: # once (4µs+4µs) by Moo::BEGIN@4 at line 96
no warnings 'prototype';
# spent 8µs making 1 call to Moo::_Utils::BEGIN@96 # spent 4µs making 1 call to warnings::unimport
9718955µs *{$glob} = $code;
98 }
99}
100
101
# spent 786µs (290+496) within Moo::_Utils::_name_coderef which was called 197 times, avg 4µs/call: # 189 times (275µs+470µs) by Moo::_Utils::_install_coderef at line 88, avg 4µs/call # 8 times (15µs+26µs) by Moo::Role::_install_does at line 372 of Moo/Role.pm, avg 5µs/call
sub _name_coderef {
10219736µs shift if @_ > 2; # three args is (target, name, sub)
103197839µs197496µs can_haz_subutil ? Sub::Util::set_subname(@_) :
# spent 496µs making 197 calls to Sub::Util::set_subname, avg 3µs/call
104 can_haz_subname ? Sub::Name::subname(@_) : $_[1];
105}
106
107sub _unimport_coderefs {
108 my ($target, $info) = @_;
109 return unless $info and my $exports = $info->{exports};
110 my %rev = reverse %$exports;
111 my $stash = _getstash($target);
112 foreach my $name (keys %$exports) {
113 if ($stash->{$name} and defined(&{$stash->{$name}})) {
114 if ($rev{$target->can($name)}) {
115 my $old = delete $stash->{$name};
116 my $full_name = join('::',$target,$name);
117 # Copy everything except the code slot back into place (e.g. $has)
118 foreach my $type (qw(SCALAR HASH ARRAY IO)) {
119 next unless defined(*{$old}{$type});
120254µs217µs
# spent 11µs (5+6) within Moo::_Utils::BEGIN@120 which was called: # once (5µs+6µs) by Moo::BEGIN@4 at line 120
no strict 'refs';
# spent 11µs making 1 call to Moo::_Utils::BEGIN@120 # spent 6µs making 1 call to strict::unimport
121 *$full_name = *{$old}{$type};
122 }
123 }
124 }
125 }
126}
127
12814µs13µsif ($Config{useithreads}) {
# spent 3µs making 1 call to Config::FETCH
129 require Moo::HandleMoose::_TypeMap;
130}
131
13213µs1;