Filename | /usr/share/perl5/YAML/Mo.pm |
Statements | Executed 77 statements in 1.89ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
16 | 6 | 2 | 218µs | 10.2ms | __ANON__[:5] | YAML::Mo::
1 | 1 | 1 | 14µs | 30µs | BEGIN@5 | YAML::Mo::
1 | 1 | 1 | 8µs | 20µs | BEGIN@5.5 | YAML::Mo::
1 | 1 | 1 | 8µs | 15µs | BEGIN@5.6 | YAML::Mo::
1 | 1 | 1 | 6µs | 16µs | BEGIN@11 | YAML::Mo::
4 | 1 | 1 | 4µs | 4µs | CORE:sort (opcode) | YAML::Mo::
3 | 1 | 1 | 2µs | 2µs | CORE:match (opcode) | YAML::Mo::
0 | 0 | 0 | 0s | 0s | __ANON__[:17] | YAML::Mo::
0 | 0 | 0 | 0s | 0s | __ANON__[:25] | YAML::Mo::
0 | 0 | 0 | 0s | 0s | __ANON__[:51] | YAML::Mo::
0 | 0 | 0 | 0s | 0s | __ANON__[:56] | YAML::Mo::
0 | 0 | 0 | 0s | 0s | __ANON__[:65] | YAML::Mo::
0 | 0 | 0 | 0s | 0s | __ANON__[:78] | YAML::Mo::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 1 | 600ns | package YAML::Mo; $VERSION = '0.88'; | ||
2 | # use Mo qw[builder default import]; | ||||
3 | # The following line of code was produced from the previous line by | ||||
4 | # Mo::Inline version 0.31 | ||||
5 | 65 | 757µs | 25 | 10.2ms | # spent 15µs (8+7) within YAML::Mo::BEGIN@5.6 which was called:
# once (8µs+7µs) by YAML::BEGIN@4 at line 5
# spent 10.2ms (218µs+9.99) within YAML::Mo::__ANON__[/usr/share/perl5/YAML/Mo.pm:5] which was called 16 times, avg 638µs/call:
# 11 times (156µs+9.97ms) by YAML::BEGIN@4 or YAML::Mo::__ANON__[/usr/share/perl5/YAML/Mo.pm:5] at line 5, avg 920µs/call
# once (18µs+9µs) by C4::Items::BEGIN@33 at line 17 of YAML.pm
# once (12µs+5µs) by C4::Items::BEGIN@33 at line 20 of YAML.pm
# once (10µs+6µs) by C4::Items::BEGIN@33 at line 18 of YAML.pm
# once (12µs+2µs) by YAML::BEGIN@4 at line 4 of YAML.pm
# once (9µs+4µs) by C4::Items::BEGIN@33 at line 19 of YAML.pm
# spent 20µs (8+12) within YAML::Mo::BEGIN@5.5 which was called:
# once (8µs+12µs) by YAML::BEGIN@4 at line 5
# spent 30µs (14+16) within YAML::Mo::BEGIN@5 which was called:
# once (14µs+16µs) by YAML::BEGIN@4 at line 5 # spent 10.1ms making 11 calls to YAML::Mo::__ANON__[YAML/Mo.pm:5], avg 920µs/call
# spent 30µs making 1 call to YAML::Mo::BEGIN@5
# spent 20µs making 1 call to YAML::Mo::BEGIN@5.5
# spent 16µs making 1 call to warnings::unimport
# spent 15µs making 1 call to YAML::Mo::BEGIN@5.6
# spent 12µs making 1 call to strict::import
# spent 12µs making 2 calls to warnings::import, avg 6µs/call
# spent 4µs making 4 calls to YAML::Mo::CORE:sort, avg 875ns/call
# spent 2µs making 3 calls to YAML::Mo::CORE:match, avg 700ns/call # spent 8.97ms executing statements in string eval # includes 8.95ms spent executing 1 call to 1 sub defined therein. # spent 1.01ms executing statements in string eval # includes 1.00ms spent executing 1 call to 1 sub defined therein. |
6 | |||||
7 | 1 | 100ns | our $DumperModule = 'Data::Dumper'; | ||
8 | |||||
9 | 1 | 100ns | my ($_new_error, $_info, $_scalar_info); | ||
10 | |||||
11 | 2 | 1.11ms | 2 | 25µs | # spent 16µs (6+9) within YAML::Mo::BEGIN@11 which was called:
# once (6µs+9µs) by YAML::BEGIN@4 at line 11 # spent 16µs making 1 call to YAML::Mo::BEGIN@11
# spent 9µs making 1 call to strict::unimport |
12 | *{$M.'Object::die'} = sub { | ||||
13 | my $self = shift; | ||||
14 | my $error = $self->$_new_error(@_); | ||||
15 | $error->type('Error'); | ||||
16 | Carp::croak($error->format_message); | ||||
17 | 1 | 2µs | }; | ||
18 | |||||
19 | *{$M.'Object::warn'} = sub { | ||||
20 | my $self = shift; | ||||
21 | return unless $^W; | ||||
22 | my $error = $self->$_new_error(@_); | ||||
23 | $error->type('Warning'); | ||||
24 | Carp::cluck($error->format_message); | ||||
25 | 1 | 2µs | }; | ||
26 | |||||
27 | # This code needs to be refactored to be simpler and more precise, and no, | ||||
28 | # Scalar::Util doesn't DWIM. | ||||
29 | # | ||||
30 | # Can't handle: | ||||
31 | # * blessed regexp | ||||
32 | *{$M.'Object::node_info'} = sub { | ||||
33 | my $self = shift; | ||||
34 | my $stringify = $_[1] || 0; | ||||
35 | my ($class, $type, $id) = | ||||
36 | ref($_[0]) | ||||
37 | ? $stringify | ||||
38 | ? &$_info("$_[0]") | ||||
39 | : do { | ||||
40 | require overload; | ||||
41 | my @info = &$_info(overload::StrVal($_[0])); | ||||
42 | if (ref($_[0]) eq 'Regexp') { | ||||
43 | @info[0, 1] = (undef, 'REGEXP'); | ||||
44 | } | ||||
45 | @info; | ||||
46 | } | ||||
47 | : &$_scalar_info($_[0]); | ||||
48 | ($class, $type, $id) = &$_scalar_info("$_[0]") | ||||
49 | unless $id; | ||||
50 | return wantarray ? ($class, $type, $id) : $id; | ||||
51 | 1 | 2µs | }; | ||
52 | |||||
53 | #------------------------------------------------------------------------------- | ||||
54 | $_info = sub { | ||||
55 | return (($_[0]) =~ qr{^(?:(.*)\=)?([^=]*)\(([^\(]*)\)$}o); | ||||
56 | 1 | 700ns | }; | ||
57 | |||||
58 | $_scalar_info = sub { | ||||
59 | my $id = 'undef'; | ||||
60 | if (defined $_[0]) { | ||||
61 | \$_[0] =~ /\((\w+)\)$/o or CORE::die(); | ||||
62 | $id = "$1-S"; | ||||
63 | } | ||||
64 | return (undef, undef, $id); | ||||
65 | 1 | 700ns | }; | ||
66 | |||||
67 | $_new_error = sub { | ||||
68 | require Carp; | ||||
69 | my $self = shift; | ||||
70 | require YAML::Error; | ||||
71 | |||||
72 | my $code = shift || 'unknown error'; | ||||
73 | my $error = YAML::Error->new(code => $code); | ||||
74 | $error->line($self->line) if $self->can('line'); | ||||
75 | $error->document($self->document) if $self->can('document'); | ||||
76 | $error->arguments([@_]); | ||||
77 | return $error; | ||||
78 | 1 | 700ns | }; | ||
79 | |||||
80 | 1 | 7µs | 1; | ||
# spent 2µs within YAML::Mo::CORE:match which was called 3 times, avg 700ns/call:
# 3 times (2µs+0s) by YAML::Mo::__ANON__[/usr/share/perl5/YAML/Mo.pm:5] at line 5, avg 700ns/call | |||||
# spent 4µs within YAML::Mo::CORE:sort which was called 4 times, avg 875ns/call:
# 4 times (4µs+0s) by YAML::Mo::__ANON__[/usr/share/perl5/YAML/Mo.pm:5] at line 5, avg 875ns/call |