← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 15:57:08 2022
Reported on Wed Dec 14 16:00:36 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Loader.pm
StatementsExecuted 39 statements in 1.65ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1116.16ms18.7msYAML::PP::Loader::::BEGIN@8YAML::PP::Loader::BEGIN@8
1112.45ms2.68msYAML::PP::Loader::::BEGIN@9YAML::PP::Loader::BEGIN@9
11135µs154µsYAML::PP::Loader::::newYAML::PP::Loader::new
11130µs34µsYAML::PP::::BEGIN@2.284 YAML::PP::BEGIN@2.284
11121µs7.34sYAML::PP::Loader::::load_fileYAML::PP::Loader::load_file
11117µs7.34sYAML::PP::Loader::::loadYAML::PP::Loader::load
1117µs104µsYAML::PP::::BEGIN@3 YAML::PP::BEGIN@3
3316µs6µsYAML::PP::::__ANON__ YAML::PP::__ANON__ (xsub)
1115µs6µsYAML::PP::Loader::::BEGIN@10YAML::PP::Loader::BEGIN@10
3314µs4µsYAML::PP::Loader::::__ANON__YAML::PP::Loader::__ANON__ (xsub)
2213µs3µsYAML::PP::Loader::::parserYAML::PP::Loader::parser
1111µs1µsYAML::PP::Loader::::constructorYAML::PP::Loader::constructor
0000s0sYAML::PP::Loader::::cloneYAML::PP::Loader::clone
0000s0sYAML::PP::Loader::::filenameYAML::PP::Loader::filename
0000s0sYAML::PP::Loader::::load_stringYAML::PP::Loader::load_string
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# ABSTRACT: Load YAML into data with Parser and Constructor
2235µs238µs
# spent 34µs (30+4) within YAML::PP::BEGIN@2.284 which was called: # once (30µs+4µs) by YAML::PP::BEGIN@10 at line 2
use strict;
# spent 34µs making 1 call to YAML::PP::BEGIN@2.284 # spent 4µs making 1 call to strict::import
3255µs2201µs
# spent 104µs (7+97) within YAML::PP::BEGIN@3 which was called: # once (7µs+97µs) by YAML::PP::BEGIN@10 at line 3
use warnings;
# spent 104µs making 1 call to YAML::PP::BEGIN@3 # spent 97µs making 1 call to warnings::import
4package YAML::PP::Loader;
5
611µsour $VERSION = '0.035'; # VERSION
7
82508µs218.7ms
# spent 18.7ms (6.16+12.6) within YAML::PP::Loader::BEGIN@8 which was called: # once (6.16ms+12.6ms) by YAML::PP::BEGIN@10 at line 8
use YAML::PP::Parser;
# spent 18.7ms making 1 call to YAML::PP::Loader::BEGIN@8 # spent 1µs making 1 call to YAML::PP::Loader::__ANON__
92519µs22.68ms
# spent 2.68ms (2.45+235µs) within YAML::PP::Loader::BEGIN@9 which was called: # once (2.45ms+235µs) by YAML::PP::BEGIN@10 at line 9
use YAML::PP::Constructor;
# spent 2.68ms making 1 call to YAML::PP::Loader::BEGIN@9 # spent 2µs making 1 call to YAML::PP::Loader::__ANON__
102463µs27µs
# spent 6µs (5+1000ns) within YAML::PP::Loader::BEGIN@10 which was called: # once (5µs+1000ns) by YAML::PP::BEGIN@10 at line 10
use YAML::PP::Reader;
# spent 6µs making 1 call to YAML::PP::Loader::BEGIN@10 # spent 1µs making 1 call to YAML::PP::Loader::__ANON__
11
12
# spent 154µs (35+119) within YAML::PP::Loader::new which was called: # once (35µs+119µs) by YAML::PP::new at line 65 of YAML/PP.pm
sub new {
1314µs my ($class, %args) = @_;
14
1512µs my $cyclic_refs = delete $args{cyclic_refs} || 'allow';
1611µs my $default_yaml_version = delete $args{default_yaml_version} || '1.2';
1711µs my $preserve = delete $args{preserve};
1811µs my $duplicate_keys = delete $args{duplicate_keys};
1911µs my $schemas = delete $args{schemas};
2011µs $schemas ||= {
21 '1.2' => YAML::PP->default_schema(
22 boolean => 'perl',
23 )
24 };
25
2615µs167µs my $constructor = delete $args{constructor} || YAML::PP::Constructor->new(
# spent 67µs making 1 call to YAML::PP::Constructor::new
27 schemas => $schemas,
28 cyclic_refs => $cyclic_refs,
29 default_yaml_version => $default_yaml_version,
30 preserve => $preserve,
31 duplicate_keys => $duplicate_keys,
32 );
3310s my $parser = delete $args{parser};
3415µs141µs unless ($parser) {
# spent 41µs making 1 call to YAML::PP::Parser::new
35 $parser = YAML::PP::Parser->new(
36 default_yaml_version => $default_yaml_version,
37 );
38 }
3914µs211µs unless ($parser->receiver) {
# spent 8µs making 1 call to YAML::PP::Parser::set_receiver # spent 3µs making 1 call to YAML::PP::Parser::receiver
40 $parser->set_receiver($constructor);
41 }
42
4311µs if (keys %args) {
44 die "Unexpected arguments: " . join ', ', sort keys %args;
45 }
4611µs my $self = bless {
47 parser => $parser,
48 constructor => $constructor,
49 }, $class;
5014µs return $self;
51}
52
53sub clone {
54 my ($self) = @_;
55 my $clone = {
56 parser => $self->parser->clone,
57 constructor => $self->constructor->clone,
58 };
59 bless $clone, ref $self;
60 $clone->parser->set_receiver($clone->constructor);
61 return $clone;
62}
63
6427µs
# spent 3µs within YAML::PP::Loader::parser which was called 2 times, avg 2µs/call: # once (2µs+0s) by YAML::PP::Loader::load_file at line 84 # once (1µs+0s) by YAML::PP::Loader::load at line 90
sub parser { return $_[0]->{parser} }
6512µs
# spent 1µs within YAML::PP::Loader::constructor which was called: # once (1µs+0s) by YAML::PP::Loader::load at line 91
sub constructor { return $_[0]->{constructor} }
66
67sub filename {
68 my ($self) = @_;
69 my $reader = $self->parser->reader;
70 if ($reader->isa('YAML::PP::Reader::File')) {
71 return $reader->input;
72 }
73 die "Reader is not a YAML::PP::Reader::File";
74}
75
76sub load_string {
77 my ($self, $yaml) = @_;
78 $self->parser->set_reader(YAML::PP::Reader->new( input => $yaml ));
79 $self->load();
80}
81
82
# spent 7.34s (21µs+7.34) within YAML::PP::Loader::load_file which was called: # once (21µs+7.34s) by YAML::PP::load_file at line 154 of YAML/PP.pm
sub load_file {
8311µs my ($self, $file) = @_;
8419µs323µs $self->parser->set_reader(YAML::PP::Reader::File->new( input => $file ));
# spent 17µs making 1 call to YAML::PP::Parser::set_reader # spent 4µs making 1 call to YAML::PP::Reader::new # spent 2µs making 1 call to YAML::PP::Loader::parser
8515µs17.34s $self->load();
# spent 7.34s making 1 call to YAML::PP::Loader::load
86}
87
88
# spent 7.34s (17µs+7.34) within YAML::PP::Loader::load which was called: # once (17µs+7.34s) by YAML::PP::Loader::load_file at line 85
sub load {
8911µs my ($self) = @_;
9011µs11µs my $parser = $self->parser;
# spent 1µs making 1 call to YAML::PP::Loader::parser
9113µs11µs my $constructor = $self->constructor;
# spent 1µs making 1 call to YAML::PP::Loader::constructor
92
9312µs134µs $constructor->init;
# spent 34µs making 1 call to YAML::PP::Constructor::init
9414µs17.34s $parser->parse();
# spent 7.34s making 1 call to YAML::PP::Parser::parse
95
9611µs11µs my $docs = $constructor->docs;
# spent 1µs making 1 call to YAML::PP::Constructor::docs
9713µs return wantarray ? @$docs : $docs->[0];
98}
99
100
10114µs1;
 
# spent 4µs within YAML::PP::Loader::__ANON__ which was called 3 times, avg 1µs/call: # once (2µs+0s) by YAML::PP::Loader::BEGIN@9 at line 9 # once (1µs+0s) by YAML::PP::Loader::BEGIN@8 at line 8 # once (1µs+0s) by YAML::PP::Loader::BEGIN@10 at line 10
sub YAML::PP::Loader::__ANON__; # xsub
# spent 6µs within YAML::PP::__ANON__ which was called 3 times, avg 2µs/call: # once (3µs+0s) by YAML::PP::BEGIN@8 at line 8 of YAML/PP.pm # once (2µs+0s) by YAML::PP::BEGIN@11 at line 11 of YAML/PP.pm # once (1µs+0s) by YAML::PP::BEGIN@10 at line 10 of YAML/PP.pm
sub YAML::PP::__ANON__; # xsub