← Index
NYTProf Performance Profile   « line view »
For index.cgi
  Run on Sat May 9 17:18:47 2020
Reported on Sat May 9 17:19:07 2020

Filename/usr/local/share/perl/5.18.2/Moo/HandleMoose/_TypeMap.pm
StatementsExecuted 17 statements in 842µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111521µs578µsMoo::HandleMoose::_TypeMap::::BEGIN@10Moo::HandleMoose::_TypeMap::BEGIN@10
11114µs42µsMoo::HandleMoose::_TypeMap::::BEGIN@2Moo::HandleMoose::_TypeMap::BEGIN@2
11112µs25µsMoo::HandleMoose::_TypeMap::::BEGIN@21Moo::HandleMoose::_TypeMap::BEGIN@21
11111µs24µsMoo::HandleMoose::_TypeMap::::BEGIN@11Moo::HandleMoose::_TypeMap::BEGIN@11
1116µs6µsMoo::HandleMoose::_TypeMap::::CLEARMoo::HandleMoose::_TypeMap::CLEAR
1113µs3µsMoo::HandleMoose::_TypeMap::::TIEHASHMoo::HandleMoose::_TypeMap::TIEHASH
0000s0sMoo::HandleMoose::_TypeMap::::CLONEMoo::HandleMoose::_TypeMap::CLONE
0000s0sMoo::HandleMoose::_TypeMap::::DELETEMoo::HandleMoose::_TypeMap::DELETE
0000s0sMoo::HandleMoose::_TypeMap::::DESTROYMoo::HandleMoose::_TypeMap::DESTROY
0000s0sMoo::HandleMoose::_TypeMap::::EXISTSMoo::HandleMoose::_TypeMap::EXISTS
0000s0sMoo::HandleMoose::_TypeMap::::FETCHMoo::HandleMoose::_TypeMap::FETCH
0000s0sMoo::HandleMoose::_TypeMap::::FIRSTKEYMoo::HandleMoose::_TypeMap::FIRSTKEY
0000s0sMoo::HandleMoose::_TypeMap::::NEXTKEYMoo::HandleMoose::_TypeMap::NEXTKEY
0000s0sMoo::HandleMoose::_TypeMap::::SCALARMoo::HandleMoose::_TypeMap::SCALAR
0000s0sMoo::HandleMoose::_TypeMap::::STOREMoo::HandleMoose::_TypeMap::STORE
0000s0sMoo::HandleMoose::_TypeMap::::_str_to_refMoo::HandleMoose::_TypeMap::_str_to_ref
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Moo::HandleMoose::_TypeMap;
2254µs271µs
# spent 42µs (14+29) within Moo::HandleMoose::_TypeMap::BEGIN@2 which was called: # once (14µs+29µs) by Moo::BEGIN@4 at line 2
use Moo::_strictures;
# spent 42µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@2 # spent 29µs making 1 call to Moo::_strictures::import
3
4package
5 Moo::HandleMoose;
61400nsour %TYPE_MAP;
7
8package Moo::HandleMoose::_TypeMap;
9
102130µs1578µs
# spent 578µs (521+56) within Moo::HandleMoose::_TypeMap::BEGIN@10 which was called: # once (521µs+56µs) by Moo::BEGIN@4 at line 10
use Scalar::Util ();
# spent 578µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@10
11299µs236µs
# spent 24µs (11+12) within Moo::HandleMoose::_TypeMap::BEGIN@11 which was called: # once (11µs+12µs) by Moo::BEGIN@4 at line 11
use Config;
# spent 24µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@11 # spent 12µs making 1 call to Config::import
12
131100nsour %WEAK_TYPES;
14
15sub _str_to_ref {
16 my $in = shift;
17 return $in
18 if ref $in;
19
20 if ($in =~ /(?:^|=)[A-Z]+\(0x([0-9a-zA-Z]+)\)$/) {
212522µs238µs
# spent 25µs (12+14) within Moo::HandleMoose::_TypeMap::BEGIN@21 which was called: # once (12µs+14µs) by Moo::BEGIN@4 at line 21
my $id = do { no warnings 'portable'; hex "$1" };
# spent 25µs making 1 call to Moo::HandleMoose::_TypeMap::BEGIN@21 # spent 14µs making 1 call to warnings::unimport
22 require B;
23 my $sv = bless \$id, 'B::SV';
24 my $ref = eval { $sv->object_2svref };
25 if (!defined $ref) {
26 die <<'END_ERROR';
27Moo initialization encountered types defined in a parent thread - ensure that
28Moo is require()d before any further thread spawns following a type definition.
29END_ERROR
30 }
31 return $ref;
32 }
33 return $in;
34}
35
3615µs
# spent 3µs within Moo::HandleMoose::_TypeMap::TIEHASH which was called: # once (3µs+0s) by Moo::BEGIN@4 at line 71
sub TIEHASH { bless {}, $_[0] }
37
38sub STORE {
39 my ($self, $key, $value) = @_;
40 my $type = _str_to_ref($key);
41 $WEAK_TYPES{$type} = $type;
42 Scalar::Util::weaken($WEAK_TYPES{$type})
43 if ref $type;
44 $self->{$key} = $value;
45}
46
47sub FETCH { $_[0]->{$_[1]} }
48sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} }
49sub NEXTKEY { each %{$_[0]} }
50sub EXISTS { exists $_[0]->{$_[1]} }
51sub DELETE { delete $_[0]->{$_[1]} }
52110µs
# spent 6µs within Moo::HandleMoose::_TypeMap::CLEAR which was called: # once (6µs+0s) by Moo::BEGIN@4 at line 72
sub CLEAR { %{$_[0]} = () }
53sub SCALAR { scalar %{$_[0]} }
54
55sub CLONE {
56 my @types = map {
57 defined $WEAK_TYPES{$_} ? ($WEAK_TYPES{$_} => $TYPE_MAP{$_}) : ()
58 } keys %TYPE_MAP;
59 %WEAK_TYPES = ();
60 %TYPE_MAP = @types;
61}
62
63sub DESTROY {
64 my %types = %{$_[0]};
65 untie %TYPE_MAP;
66 %TYPE_MAP = %types;
67}
68
6918µs15µsif ($Config{useithreads}) {
# spent 5µs making 1 call to Config::FETCH
7011µs my @types = %TYPE_MAP;
7114µs13µs tie %TYPE_MAP, __PACKAGE__;
# spent 3µs making 1 call to Moo::HandleMoose::_TypeMap::TIEHASH
7214µs16µs %TYPE_MAP = @types;
# spent 6µs making 1 call to Moo::HandleMoose::_TypeMap::CLEAR
73}
74
7515µs1;