← 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/Parser.pm
StatementsExecuted 2774199 statements in 2.24s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111894ms7.34sYAML::PP::Parser::::parse_tokensYAML::PP::Parser::parse_tokens
1345121304ms1.85sYAML::PP::Parser::::lex_next_tokensYAML::PP::Parser::lex_next_tokens
2094141231ms1.40sYAML::PP::Parser::::scalar_eventYAML::PP::Parser::scalar_event
36113131121ms1.62sYAML::PP::Parser::::__ANON__[:62]YAML::PP::Parser::__ANON__[:62]
67251179.2ms300msYAML::PP::Parser::::start_mappingYAML::PP::Parser::start_mapping
28162172.0ms319msYAML::PP::Parser::::remove_nodesYAML::PP::Parser::remove_nodes
67251170.9ms904msYAML::PP::Parser::::cb_insert_mapYAML::PP::Parser::cb_insert_map
74974166.9ms496msYAML::PP::Parser::::cb_send_scalarYAML::PP::Parser::cb_send_scalar
121801164.5ms72.2msYAML::PP::Parser::::cb_start_plainYAML::PP::Parser::cb_start_plain
550807162.3ms62.3msYAML::PP::Parser::::set_ruleYAML::PP::Parser::set_rule
66902149.2ms503msYAML::PP::Parser::::cb_send_mapkeyYAML::PP::Parser::cb_send_mapkey
66751142.0ms46.3msYAML::PP::Parser::::cb_mapkeyYAML::PP::Parser::cb_mapkey
7037914134.4ms34.4msYAML::PP::Parser::::event_stackYAML::PP::Parser::event_stack
6274523133.2ms33.2msYAML::PP::Parser::::eventsYAML::PP::Parser::events
553377128.9ms28.9msYAML::PP::Parser::::lexerYAML::PP::Parser::lexer
3623711123.3ms23.3msYAML::PP::Parser::::set_new_nodeYAML::PP::Parser::set_new_node
3196915118.2ms18.2msYAML::PP::Parser::::offsetYAML::PP::Parser::offset
3611313118.0ms18.0msYAML::PP::Parser::::callbackYAML::PP::Parser::callback
20562116.0ms17.2msYAML::PP::Parser::::cb_take_quotedYAML::PP::Parser::cb_take_quoted
274507115.1ms15.1msYAML::PP::Parser::::new_nodeYAML::PP::Parser::new_node
134502112.4ms12.4msYAML::PP::Parser::::ruleYAML::PP::Parser::rule
134502111.3ms11.3msYAML::PP::Parser::::tokensYAML::PP::Parser::tokens
69932110.0ms10.0msYAML::PP::Parser::::levelYAML::PP::Parser::level
15241717.98ms7.98msYAML::PP::Parser::::CORE:matchYAML::PP::Parser::CORE:match (opcode)
337117.22ms18.1msYAML::PP::Parser::::start_flow_sequenceYAML::PP::Parser::start_flow_sequence
689115.99ms56.5msYAML::PP::Parser::::cb_flow_commaYAML::PP::Parser::cb_flow_comma
1115.53ms8.86msYAML::PP::Parser::::BEGIN@18YAML::PP::Parser::BEGIN@18
214114.98ms12.9msYAML::PP::Parser::::start_flow_mappingYAML::PP::Parser::start_flow_mapping
337114.90ms14.8msYAML::PP::Parser::::end_flow_sequenceYAML::PP::Parser::end_flow_sequence
308114.39ms14.8msYAML::PP::Parser::::start_sequenceYAML::PP::Parser::start_sequence
262113.63ms9.77msYAML::PP::Parser::::end_sequenceYAML::PP::Parser::end_sequence
214113.24ms10.5msYAML::PP::Parser::::end_flow_mappingYAML::PP::Parser::end_flow_mapping
337112.71ms41.3msYAML::PP::Parser::::cb_end_flowseqYAML::PP::Parser::cb_end_flowseq
528112.43ms2.81msYAML::PP::Parser::::cb_end_outer_flowYAML::PP::Parser::cb_end_outer_flow
308111.92ms17.0msYAML::PP::Parser::::cb_seqstartYAML::PP::Parser::cb_seqstart
214111.38ms12.1msYAML::PP::Parser::::cb_end_flowmapYAML::PP::Parser::cb_end_flowmap
337111.29ms19.3msYAML::PP::Parser::::cb_start_flowseqYAML::PP::Parser::cb_start_flowseq
302111.14ms1.37msYAML::PP::Parser::::cb_seqitemYAML::PP::Parser::cb_seqitem
1111.13ms1.23msYAML::PP::Parser::::BEGIN@17YAML::PP::Parser::BEGIN@17
214111.05ms13.9msYAML::PP::Parser::::cb_start_flowmapYAML::PP::Parser::cb_start_flowmap
111981µs1.10msYAML::PP::Parser::::BEGIN@20YAML::PP::Parser::BEGIN@20
111805µs943µsYAML::PP::Parser::::BEGIN@21YAML::PP::Parser::BEGIN@21
2911493µs3.39msYAML::PP::Parser::::cb_flowkey_plainYAML::PP::Parser::cb_flowkey_plain
2911112µs129µsYAML::PP::Parser::::cb_flow_colonYAML::PP::Parser::cb_flow_colon
151197µs909µsYAML::PP::Parser::::cb_take_quoted_keyYAML::PP::Parser::cb_take_quoted_key
11145µs74µsYAML::PP::Parser::::initYAML::PP::Parser::init
11137µs7.34sYAML::PP::Parser::::parseYAML::PP::Parser::parse
11136µs39µsYAML::PP::Loader::::BEGIN@2YAML::PP::Loader::BEGIN@2
11135µs1.33msYAML::PP::Parser::::end_documentYAML::PP::Parser::end_document
11126µs51µsYAML::PP::Parser::::start_documentYAML::PP::Parser::start_document
11120µs209µsYAML::PP::Parser::::cb_send_block_scalarYAML::PP::Parser::cb_send_block_scalar
11117µs41µsYAML::PP::Parser::::newYAML::PP::Parser::new
11117µs32µsYAML::PP::Parser::::start_streamYAML::PP::Parser::start_stream
11116µs56µsYAML::PP::Parser::::BEGIN@11YAML::PP::Parser::BEGIN@11
11112µs19µsYAML::PP::Parser::::end_streamYAML::PP::Parser::end_stream
11112µs17µsYAML::PP::Parser::::set_readerYAML::PP::Parser::set_reader
11111µs35µsYAML::PP::Parser::::BEGIN@97YAML::PP::Parser::BEGIN@97
1118µs110µsYAML::PP::Parser::::BEGIN@19YAML::PP::Parser::BEGIN@19
1118µs71µsYAML::PP::Parser::::BEGIN@8YAML::PP::Parser::BEGIN@8
1118µs52µsYAML::PP::Parser::::BEGIN@9YAML::PP::Parser::BEGIN@9
1118µs8µsYAML::PP::Parser::::set_receiverYAML::PP::Parser::set_receiver
1117µs21µsYAML::PP::Parser::::BEGIN@22YAML::PP::Parser::BEGIN@22
2216µs6µsYAML::PP::Parser::::set_yaml_version_directiveYAML::PP::Parser::set_yaml_version_directive
1115µs56µsYAML::PP::Parser::::cb_doc_start_explicitYAML::PP::Parser::cb_doc_start_explicit
4415µs5µsYAML::PP::Parser::::__ANON__YAML::PP::Parser::__ANON__ (xsub)
1114µs33µsYAML::PP::Loader::::BEGIN@3YAML::PP::Loader::BEGIN@3
2214µs4µsYAML::PP::Parser::::set_tagmapYAML::PP::Parser::set_tagmap
1113µs3µsYAML::PP::Parser::::receiverYAML::PP::Parser::receiver
1113µs3µsYAML::PP::Parser::::set_offsetYAML::PP::Parser::set_offset
1112µs2µsYAML::PP::Parser::::set_tokensYAML::PP::Parser::set_tokens
1112µs2µsYAML::PP::Parser::::yaml_version_directiveYAML::PP::Parser::yaml_version_directive
1111µs1µsYAML::PP::Parser::::default_yaml_versionYAML::PP::Parser::default_yaml_version
1111µs1µsYAML::PP::Parser::::set_event_stackYAML::PP::Parser::set_event_stack
1111µs1µsYAML::PP::Parser::::set_yaml_versionYAML::PP::Parser::set_yaml_version
1111µs1µsYAML::PP::Parser::::yaml_versionYAML::PP::Parser::yaml_version
0000s0sYAML::PP::Parser::::__ANON__[:743]YAML::PP::Parser::__ANON__[:743]
0000s0sYAML::PP::Parser::::_colorize_warnYAML::PP::Parser::_colorize_warn
0000s0sYAML::PP::Parser::::_read_tagYAML::PP::Parser::_read_tag
0000s0sYAML::PP::Parser::::_remaining_tokensYAML::PP::Parser::_remaining_tokens
0000s0sYAML::PP::Parser::::alias_eventYAML::PP::Parser::alias_event
0000s0sYAML::PP::Parser::::cb_aliasYAML::PP::Parser::cb_alias
0000s0sYAML::PP::Parser::::cb_anchorYAML::PP::Parser::cb_anchor
0000s0sYAML::PP::Parser::::cb_complexcolonYAML::PP::Parser::cb_complexcolon
0000s0sYAML::PP::Parser::::cb_doc_start_implicitYAML::PP::Parser::cb_doc_start_implicit
0000s0sYAML::PP::Parser::::cb_empty_complexvalueYAML::PP::Parser::cb_empty_complexvalue
0000s0sYAML::PP::Parser::::cb_empty_flow_mapkeyYAML::PP::Parser::cb_empty_flow_mapkey
0000s0sYAML::PP::Parser::::cb_empty_flowmap_key_valueYAML::PP::Parser::cb_empty_flowmap_key_value
0000s0sYAML::PP::Parser::::cb_empty_flowmap_valueYAML::PP::Parser::cb_empty_flowmap_value
0000s0sYAML::PP::Parser::::cb_empty_flowseq_commaYAML::PP::Parser::cb_empty_flowseq_comma
0000s0sYAML::PP::Parser::::cb_empty_flowseq_endYAML::PP::Parser::cb_empty_flowseq_end
0000s0sYAML::PP::Parser::::cb_empty_mapkeyYAML::PP::Parser::cb_empty_mapkey
0000s0sYAML::PP::Parser::::cb_end_doc_start_documentYAML::PP::Parser::cb_end_doc_start_document
0000s0sYAML::PP::Parser::::cb_end_documentYAML::PP::Parser::cb_end_document
0000s0sYAML::PP::Parser::::cb_end_document_emptyYAML::PP::Parser::cb_end_document_empty
0000s0sYAML::PP::Parser::::cb_end_empty_flowmap_key_valueYAML::PP::Parser::cb_end_empty_flowmap_key_value
0000s0sYAML::PP::Parser::::cb_end_flowmap_emptyYAML::PP::Parser::cb_end_flowmap_empty
0000s0sYAML::PP::Parser::::cb_flow_questionYAML::PP::Parser::cb_flow_question
0000s0sYAML::PP::Parser::::cb_flowkey_quotedYAML::PP::Parser::cb_flowkey_quoted
0000s0sYAML::PP::Parser::::cb_insert_empty_implicit_flowseq_mapYAML::PP::Parser::cb_insert_empty_implicit_flowseq_map
0000s0sYAML::PP::Parser::::cb_insert_empty_mapYAML::PP::Parser::cb_insert_empty_map
0000s0sYAML::PP::Parser::::cb_insert_implicit_flowseq_mapYAML::PP::Parser::cb_insert_implicit_flowseq_map
0000s0sYAML::PP::Parser::::cb_insert_map_aliasYAML::PP::Parser::cb_insert_map_alias
0000s0sYAML::PP::Parser::::cb_property_eolYAML::PP::Parser::cb_property_eol
0000s0sYAML::PP::Parser::::cb_questionYAML::PP::Parser::cb_question
0000s0sYAML::PP::Parser::::cb_questionstartYAML::PP::Parser::cb_questionstart
0000s0sYAML::PP::Parser::::cb_quoted_multilineYAML::PP::Parser::cb_quoted_multiline
0000s0sYAML::PP::Parser::::cb_reserved_directiveYAML::PP::Parser::cb_reserved_directive
0000s0sYAML::PP::Parser::::cb_send_aliasYAML::PP::Parser::cb_send_alias
0000s0sYAML::PP::Parser::::cb_send_alias_from_stackYAML::PP::Parser::cb_send_alias_from_stack
0000s0sYAML::PP::Parser::::cb_send_alias_keyYAML::PP::Parser::cb_send_alias_key
0000s0sYAML::PP::Parser::::cb_send_flow_aliasYAML::PP::Parser::cb_send_flow_alias
0000s0sYAML::PP::Parser::::cb_send_plain_multiYAML::PP::Parser::cb_send_plain_multi
0000s0sYAML::PP::Parser::::cb_set_yaml_version_directiveYAML::PP::Parser::cb_set_yaml_version_directive
0000s0sYAML::PP::Parser::::cb_tagYAML::PP::Parser::cb_tag
0000s0sYAML::PP::Parser::::cb_tag_directiveYAML::PP::Parser::cb_tag_directive
0000s0sYAML::PP::Parser::::cloneYAML::PP::Parser::clone
0000s0sYAML::PP::Parser::::debug_eventYAML::PP::Parser::debug_event
0000s0sYAML::PP::Parser::::debug_eventsYAML::PP::Parser::debug_events
0000s0sYAML::PP::Parser::::debug_next_lineYAML::PP::Parser::debug_next_line
0000s0sYAML::PP::Parser::::debug_offsetYAML::PP::Parser::debug_offset
0000s0sYAML::PP::Parser::::debug_rulesYAML::PP::Parser::debug_rules
0000s0sYAML::PP::Parser::::debug_tokensYAML::PP::Parser::debug_tokens
0000s0sYAML::PP::Parser::::debug_yamlYAML::PP::Parser::debug_yaml
0000s0sYAML::PP::Parser::::event_to_test_suiteYAML::PP::Parser::event_to_test_suite
0000s0sYAML::PP::Parser::::exceptionYAML::PP::Parser::exception
0000s0sYAML::PP::Parser::::expectedYAML::PP::Parser::expected
0000s0sYAML::PP::Parser::::fetch_inline_propertiesYAML::PP::Parser::fetch_inline_properties
0000s0sYAML::PP::Parser::::gotYAML::PP::Parser::got
0000s0sYAML::PP::Parser::::highlight_yamlYAML::PP::Parser::highlight_yaml
0000s0sYAML::PP::Parser::::infoYAML::PP::Parser::info
0000s0sYAML::PP::Parser::::node_propertiesYAML::PP::Parser::node_properties
0000s0sYAML::PP::Parser::::noteYAML::PP::Parser::note
0000s0sYAML::PP::Parser::::parse_fileYAML::PP::Parser::parse_file
0000s0sYAML::PP::Parser::::parse_stringYAML::PP::Parser::parse_string
0000s0sYAML::PP::Parser::::readerYAML::PP::Parser::reader
0000s0sYAML::PP::Parser::::set_callbackYAML::PP::Parser::set_callback
1110s0sYAML::PP::Parser::::set_eventsYAML::PP::Parser::set_events
0000s0sYAML::PP::Parser::::tagmapYAML::PP::Parser::tagmap
0000s0sYAML::PP::Parser::::yaml_to_tokensYAML::PP::Parser::yaml_to_tokens
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# ABSTRACT: YAML Parser
2236µs242µs
# spent 39µs (36+3) within YAML::PP::Loader::BEGIN@2 which was called: # once (36µs+3µs) by YAML::PP::Loader::BEGIN@8 at line 2
use strict;
# spent 39µs making 1 call to YAML::PP::Loader::BEGIN@2 # spent 3µs making 1 call to strict::import
3255µs262µs
# spent 33µs (4+29) within YAML::PP::Loader::BEGIN@3 which was called: # once (4µs+29µs) by YAML::PP::Loader::BEGIN@8 at line 3
use warnings;
# spent 33µs making 1 call to YAML::PP::Loader::BEGIN@3 # spent 29µs making 1 call to warnings::import
4package YAML::PP::Parser;
5
611µsour $VERSION = '0.035'; # VERSION
7
8246µs2134µs
# spent 71µs (8+63) within YAML::PP::Parser::BEGIN@8 which was called: # once (8µs+63µs) by YAML::PP::Loader::BEGIN@8 at line 8
use constant TRACE => $ENV{YAML_PP_TRACE} ? 1 : 0;
# spent 71µs making 1 call to YAML::PP::Parser::BEGIN@8 # spent 63µs making 1 call to constant::import
9254µs296µs
# spent 52µs (8+44) within YAML::PP::Parser::BEGIN@9 which was called: # once (8µs+44µs) by YAML::PP::Loader::BEGIN@8 at line 9
use constant DEBUG => ($ENV{YAML_PP_DEBUG} || $ENV{YAML_PP_TRACE}) ? 1 : 0;
# spent 52µs making 1 call to YAML::PP::Parser::BEGIN@9 # spent 44µs making 1 call to constant::import
10
1111µs
# spent 56µs (16+40) within YAML::PP::Parser::BEGIN@11 which was called: # once (16µs+40µs) by YAML::PP::Loader::BEGIN@8 at line 16
use YAML::PP::Common qw/
12 YAML_PLAIN_SCALAR_STYLE YAML_SINGLE_QUOTED_SCALAR_STYLE
13 YAML_DOUBLE_QUOTED_SCALAR_STYLE
14 YAML_LITERAL_SCALAR_STYLE YAML_FOLDED_SCALAR_STYLE
15 YAML_FLOW_SEQUENCE_STYLE YAML_FLOW_MAPPING_STYLE
16150µs296µs/;
# spent 56µs making 1 call to YAML::PP::Parser::BEGIN@11 # spent 40µs making 1 call to Exporter::import
172531µs21.23ms
# spent 1.23ms (1.13+100µs) within YAML::PP::Parser::BEGIN@17 which was called: # once (1.13ms+100µs) by YAML::PP::Loader::BEGIN@8 at line 17
use YAML::PP::Render;
# spent 1.23ms making 1 call to YAML::PP::Parser::BEGIN@17 # spent 1µs making 1 call to YAML::PP::Parser::__ANON__
182496µs28.87ms
# spent 8.86ms (5.53+3.34) within YAML::PP::Parser::BEGIN@18 which was called: # once (5.53ms+3.34ms) by YAML::PP::Loader::BEGIN@8 at line 18
use YAML::PP::Lexer;
# spent 8.86ms making 1 call to YAML::PP::Parser::BEGIN@18 # spent 2µs making 1 call to YAML::PP::Parser::__ANON__
19233µs2212µs
# spent 110µs (8+102) within YAML::PP::Parser::BEGIN@19 which was called: # once (8µs+102µs) by YAML::PP::Loader::BEGIN@8 at line 19
use YAML::PP::Grammar qw/ $GRAMMAR /;
# spent 110µs making 1 call to YAML::PP::Parser::BEGIN@19 # spent 102µs making 1 call to Exporter::import
202607µs21.10ms
# spent 1.10ms (981µs+123µs) within YAML::PP::Parser::BEGIN@20 which was called: # once (981µs+123µs) by YAML::PP::Loader::BEGIN@8 at line 20
use YAML::PP::Exception;
# spent 1.10ms making 1 call to YAML::PP::Parser::BEGIN@20 # spent 1µs making 1 call to YAML::PP::Parser::__ANON__
212377µs2944µs
# spent 943µs (805+138) within YAML::PP::Parser::BEGIN@21 which was called: # once (805µs+138µs) by YAML::PP::Loader::BEGIN@8 at line 21
use YAML::PP::Reader;
# spent 943µs making 1 call to YAML::PP::Parser::BEGIN@21 # spent 1µs making 1 call to YAML::PP::Parser::__ANON__
222472µs235µs
# spent 21µs (7+14) within YAML::PP::Parser::BEGIN@22 which was called: # once (7µs+14µs) by YAML::PP::Loader::BEGIN@8 at line 22
use Carp qw/ croak /;
# spent 21µs making 1 call to YAML::PP::Parser::BEGIN@22 # spent 14µs making 1 call to Exporter::import
23
24
25
# spent 41µs (17+24) within YAML::PP::Parser::new which was called: # once (17µs+24µs) by YAML::PP::Loader::new at line 34 of YAML/PP/Loader.pm
sub new {
2611µs my ($class, %args) = @_;
2714µs16µs my $reader = delete $args{reader} || YAML::PP::Reader->new;
# spent 6µs making 1 call to YAML::PP::Reader::new
2810s my $default_yaml_version = delete $args{default_yaml_version};
2917µs118µs my $self = bless {
# spent 18µs making 1 call to YAML::PP::Lexer::new
30 default_yaml_version => $default_yaml_version || '1.2',
31 lexer => YAML::PP::Lexer->new(
32 reader => $reader,
33 ),
34 }, $class;
3510s my $receiver = delete $args{receiver};
3610s if ($receiver) {
37 $self->set_receiver($receiver);
38 }
3915µs return $self;
40}
41
42sub clone {
43 my ($self) = @_;
44 my $clone = {
45 default_yaml_version => $self->default_yaml_version,
46 lexer => YAML::PP::Lexer->new(),
47 };
48 return bless $clone, ref $self;
49}
50
5114µs
# spent 3µs within YAML::PP::Parser::receiver which was called: # once (3µs+0s) by YAML::PP::Loader::new at line 39 of YAML/PP/Loader.pm
sub receiver { return $_[0]->{receiver} }
52
# spent 8µs within YAML::PP::Parser::set_receiver which was called: # once (8µs+0s) by YAML::PP::Loader::new at line 39 of YAML/PP/Loader.pm
sub set_receiver {
5311µs my ($self, $receiver) = @_;
5410s my $callback;
5512µs if (ref $receiver eq 'CODE') {
56 $callback = $receiver;
57 }
58 else {
59
# spent 1.62s (121ms+1.49) within YAML::PP::Parser::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Parser.pm:62] which was called 36113 times, avg 45µs/call: # 20941 times (67.0ms+1.05s) by YAML::PP::Parser::scalar_event at line 723, avg 54µs/call # 6771 times (22.4ms+217ms) by YAML::PP::Parser::remove_nodes at line 475, avg 35µs/call # 6725 times (24.7ms+182ms) by YAML::PP::Parser::start_mapping at line 626, avg 31µs/call # 337 times (1.23ms+8.48ms) by YAML::PP::Parser::start_flow_sequence at line 551, avg 29µs/call # 337 times (1.22ms+7.39ms) by YAML::PP::Parser::end_flow_sequence at line 584, avg 26µs/call # 308 times (1.43ms+8.36ms) by YAML::PP::Parser::start_sequence at line 527, avg 32µs/call # 262 times (1.02ms+4.77ms) by YAML::PP::Parser::end_sequence at line 453, avg 22µs/call # 214 times (867µs+6.15ms) by YAML::PP::Parser::start_flow_mapping at line 575, avg 33µs/call # 214 times (774µs+5.70ms) by YAML::PP::Parser::end_flow_mapping at line 599, avg 30µs/call # once (3µs+23µs) by YAML::PP::Parser::end_document at line 649 # once (5µs+11µs) by YAML::PP::Parser::start_document at line 501 # once (7µs+0s) by YAML::PP::Parser::start_stream at line 486 # once (2µs+2µs) by YAML::PP::Parser::end_stream at line 667
$callback = sub {
603611310.1ms my ($self, $event, $info) = @_;
6136113105ms361131.49s return $receiver->$event($info);
# spent 1.05s making 20941 calls to YAML::PP::Constructor::scalar_event, avg 50µs/call # spent 223ms making 6939 calls to YAML::PP::Constructor::mapping_end_event, avg 32µs/call # spent 188ms making 6939 calls to YAML::PP::Constructor::mapping_start_event, avg 27µs/call # spent 16.8ms making 645 calls to YAML::PP::Constructor::sequence_start_event, avg 26µs/call # spent 12.8ms making 645 calls to YAML::PP::Constructor::sequence_end_event, avg 20µs/call # spent 23µs making 1 call to YAML::PP::Constructor::document_end_event # spent 11µs making 1 call to YAML::PP::Constructor::document_start_event # spent 2µs making 1 call to YAML::PP::Constructor::stream_end_event # spent 0s making 1 call to YAML::PP::Constructor::stream_start_event
6214µs };
63 }
6410s $self->{callback} = $callback;
6512µs $self->{receiver} = $receiver;
66}
67sub reader { return $_[0]->lexer->{reader} }
68
# spent 17µs (12+5) within YAML::PP::Parser::set_reader which was called: # once (12µs+5µs) by YAML::PP::Loader::load_file at line 84 of YAML/PP/Loader.pm
sub set_reader {
6910s my ($self, $reader) = @_;
7017µs25µs $self->lexer->set_reader($reader);
# spent 4µs making 1 call to YAML::PP::Lexer::set_reader # spent 1µs making 1 call to YAML::PP::Parser::lexer
71}
725533781.2ms
# spent 28.9ms within YAML::PP::Parser::lexer which was called 55337 times, avg 521ns/call: # 20941 times (13.4ms+0s) by YAML::PP::Parser::parse_tokens at line 379, avg 641ns/call # 20941 times (8.28ms+0s) by YAML::PP::Parser::parse_tokens at line 381, avg 396ns/call # 13451 times (7.15ms+0s) by YAML::PP::Parser::lex_next_tokens at line 179, avg 532ns/call # once (1µs+0s) by YAML::PP::Parser::set_reader at line 70 # once (1µs+0s) by YAML::PP::Parser::init at line 115 # once (0s+0s) by YAML::PP::Parser::parse at line 151 # once (0s+0s) by YAML::PP::Parser::parse_tokens at line 344
sub lexer { return $_[0]->{lexer} }
733611346.5ms
# spent 18.0ms within YAML::PP::Parser::callback which was called 36113 times, avg 498ns/call: # 20941 times (10.0ms+0s) by YAML::PP::Parser::scalar_event at line 723, avg 479ns/call # 6771 times (3.81ms+0s) by YAML::PP::Parser::remove_nodes at line 475, avg 562ns/call # 6725 times (3.39ms+0s) by YAML::PP::Parser::start_mapping at line 626, avg 505ns/call # 337 times (140µs+0s) by YAML::PP::Parser::start_flow_sequence at line 551, avg 415ns/call # 337 times (139µs+0s) by YAML::PP::Parser::end_flow_sequence at line 584, avg 412ns/call # 308 times (134µs+0s) by YAML::PP::Parser::start_sequence at line 527, avg 435ns/call # 262 times (126µs+0s) by YAML::PP::Parser::end_sequence at line 453, avg 481ns/call # 214 times (120µs+0s) by YAML::PP::Parser::start_flow_mapping at line 575, avg 561ns/call # 214 times (103µs+0s) by YAML::PP::Parser::end_flow_mapping at line 599, avg 481ns/call # once (5µs+0s) by YAML::PP::Parser::start_stream at line 486 # once (1µs+0s) by YAML::PP::Parser::start_document at line 501 # once (1µs+0s) by YAML::PP::Parser::end_stream at line 667 # once (1µs+0s) by YAML::PP::Parser::end_document at line 649
sub callback { return $_[0]->{callback} }
74sub set_callback { $_[0]->{callback} = $_[1] }
75699317.1ms
# spent 10.0ms within YAML::PP::Parser::level which was called 6993 times, avg 1µs/call: # 6992 times (10.0ms+0s) by YAML::PP::Parser::parse_tokens at line 431, avg 1µs/call # once (2µs+0s) by YAML::PP::Parser::parse_tokens at line 351
sub level { return $#{ $_[0]->{offset} } }
763196957.6ms
# spent 18.2ms within YAML::PP::Parser::offset which was called 31969 times, avg 569ns/call: # 13451 times (7.95ms+0s) by YAML::PP::Parser::lex_next_tokens at line 177, avg 591ns/call # 7300 times (3.41ms+0s) by YAML::PP::Parser::lex_next_tokens at line 239, avg 467ns/call # 6725 times (4.32ms+0s) by YAML::PP::Parser::start_mapping at line 617, avg 643ns/call # 2816 times (1.52ms+0s) by YAML::PP::Parser::remove_nodes at line 459, avg 541ns/call # 337 times (265µs+0s) by YAML::PP::Parser::end_flow_sequence at line 582, avg 786ns/call # 337 times (209µs+0s) by YAML::PP::Parser::start_flow_sequence at line 532, avg 620ns/call # 308 times (184µs+0s) by YAML::PP::Parser::start_sequence at line 513, avg 597ns/call # 262 times (103µs+0s) by YAML::PP::Parser::end_sequence at line 451, avg 393ns/call # 214 times (129µs+0s) by YAML::PP::Parser::start_flow_mapping at line 556, avg 603ns/call # 214 times (88µs+0s) by YAML::PP::Parser::end_flow_mapping at line 597, avg 411ns/call # once (1µs+0s) by YAML::PP::Parser::start_stream at line 485 # once (1µs+0s) by YAML::PP::Parser::end_document at line 648 # once (0s+0s) by YAML::PP::Parser::parse_tokens at line 342 # once (0s+0s) by YAML::PP::Parser::start_document at line 494 # once (0s+0s) by YAML::PP::Parser::end_stream at line 666
sub offset { return $_[0]->{offset} }
7715µs
# spent 3µs within YAML::PP::Parser::set_offset which was called: # once (3µs+0s) by YAML::PP::Parser::init at line 104
sub set_offset { $_[0]->{offset} = $_[1] }
786274595.9ms
# spent 33.2ms within YAML::PP::Parser::events which was called 62745 times, avg 530ns/call: # 20941 times (12.1ms+0s) by YAML::PP::Parser::scalar_event at line 715, avg 576ns/call # 13451 times (6.08ms+0s) by YAML::PP::Parser::lex_next_tokens at line 178, avg 452ns/call # 7497 times (3.90ms+0s) by YAML::PP::Parser::cb_send_scalar at line 1057, avg 520ns/call # 7300 times (3.98ms+0s) by YAML::PP::Parser::lex_next_tokens at line 231, avg 545ns/call # 6725 times (3.70ms+0s) by YAML::PP::Parser::start_mapping at line 618, avg 550ns/call # 2816 times (1.32ms+0s) by YAML::PP::Parser::remove_nodes at line 460, avg 469ns/call # 689 times (466µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1238, avg 676ns/call # 528 times (387µs+0s) by YAML::PP::Parser::cb_end_outer_flow at line 610, avg 733ns/call # 337 times (149µs+0s) by YAML::PP::Parser::start_flow_sequence at line 534, avg 442ns/call # 337 times (128µs+0s) by YAML::PP::Parser::end_flow_sequence at line 580, avg 380ns/call # 337 times (124µs+0s) by YAML::PP::Parser::start_flow_sequence at line 543, avg 368ns/call # 308 times (174µs+0s) by YAML::PP::Parser::lex_next_tokens at line 216, avg 565ns/call # 308 times (138µs+0s) by YAML::PP::Parser::start_sequence at line 514, avg 448ns/call # 262 times (141µs+0s) by YAML::PP::Parser::lex_next_tokens at line 236, avg 538ns/call # 262 times (118µs+0s) by YAML::PP::Parser::end_sequence at line 449, avg 450ns/call # 214 times (119µs+0s) by YAML::PP::Parser::end_flow_mapping at line 595, avg 556ns/call # 214 times (117µs+0s) by YAML::PP::Parser::start_flow_mapping at line 567, avg 547ns/call # 214 times (114µs+0s) by YAML::PP::Parser::start_flow_mapping at line 558, avg 533ns/call # once (2µs+0s) by YAML::PP::Parser::start_stream at line 484 # once (2µs+0s) by YAML::PP::Parser::end_stream at line 664 # once (2µs+0s) by YAML::PP::Parser::start_document at line 493 # once (0s+0s) by YAML::PP::Parser::end_document at line 632 # once (0s+0s) by YAML::PP::Parser::parse_tokens at line 341
sub events { return $_[0]->{events} }
7912µs
# spent 0s within YAML::PP::Parser::set_events which was called: # once (0s+0s) by YAML::PP::Parser::init at line 105
sub set_events { $_[0]->{events} = $_[1] }
802745042.7ms
# spent 15.1ms within YAML::PP::Parser::new_node which was called 27450 times, avg 549ns/call: # 13449 times (6.34ms+0s) by YAML::PP::Parser::parse_tokens at line 430, avg 472ns/call # 7300 times (4.85ms+0s) by YAML::PP::Parser::lex_next_tokens at line 209, avg 664ns/call # 6148 times (3.60ms+0s) by YAML::PP::Parser::lex_next_tokens at line 204, avg 586ns/call # 337 times (165µs+0s) by YAML::PP::Parser::start_flow_sequence at line 535, avg 490ns/call # 214 times (111µs+0s) by YAML::PP::Parser::start_flow_mapping at line 559, avg 519ns/call # once (2µs+0s) by YAML::PP::Parser::parse_tokens at line 350 # once (1µs+0s) by YAML::PP::Parser::end_document at line 636
sub new_node { return $_[0]->{new_node} }
813623754.5ms
# spent 23.3ms within YAML::PP::Parser::set_new_node which was called 36237 times, avg 643ns/call: # 20941 times (16.4ms+0s) by YAML::PP::Parser::scalar_event at line 724, avg 784ns/call # 6725 times (2.85ms+0s) by YAML::PP::Parser::cb_insert_map at line 1367, avg 423ns/call # 6690 times (2.75ms+0s) by YAML::PP::Parser::cb_send_mapkey at line 1049, avg 411ns/call # 689 times (455µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1239, avg 660ns/call # 337 times (207µs+0s) by YAML::PP::Parser::cb_end_flowseq at line 1233, avg 614ns/call # 308 times (215µs+0s) by YAML::PP::Parser::cb_seqstart at line 1141, avg 698ns/call # 302 times (227µs+0s) by YAML::PP::Parser::cb_seqitem at line 1146, avg 752ns/call # 214 times (161µs+0s) by YAML::PP::Parser::cb_end_flowmap at line 1268, avg 752ns/call # 29 times (17µs+0s) by YAML::PP::Parser::cb_flow_colon at line 1248, avg 586ns/call # once (5µs+0s) by YAML::PP::Parser::init at line 106 # once (1µs+0s) by YAML::PP::Parser::start_document at line 508
sub set_new_node { $_[0]->{new_node} = $_[1] }
82sub tagmap { return $_[0]->{tagmap} }
8326µs
# spent 4µs within YAML::PP::Parser::set_tagmap which was called 2 times, avg 2µs/call: # once (2µs+0s) by YAML::PP::Parser::end_document at line 653 # once (2µs+0s) by YAML::PP::Parser::init at line 107
sub set_tagmap { $_[0]->{tagmap} = $_[1] }
841345022.9ms
# spent 11.3ms within YAML::PP::Parser::tokens which was called 13450 times, avg 838ns/call: # 13449 times (11.3ms+0s) by YAML::PP::Parser::lex_next_tokens at line 187, avg 838ns/call # once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 343
sub tokens { return $_[0]->{tokens} }
8514µs
# spent 2µs within YAML::PP::Parser::set_tokens which was called: # once (2µs+0s) by YAML::PP::Parser::init at line 110
sub set_tokens { $_[0]->{tokens} = $_[1] }
867037999.2ms
# spent 34.4ms within YAML::PP::Parser::event_stack which was called 70379 times, avg 489ns/call: # 20941 times (8.64ms+0s) by YAML::PP::Parser::scalar_event at line 716, avg 412ns/call # 12180 times (7.67ms+0s) by YAML::PP::Parser::cb_start_plain at line 1207, avg 630ns/call # 7497 times (3.34ms+0s) by YAML::PP::Parser::cb_send_scalar at line 1054, avg 446ns/call # 6725 times (3.12ms+0s) by YAML::PP::Parser::cb_insert_map at line 1362, avg 465ns/call # 6725 times (2.60ms+0s) by YAML::PP::Parser::start_mapping at line 620, avg 387ns/call # 6690 times (3.01ms+0s) by YAML::PP::Parser::cb_send_mapkey at line 1047, avg 450ns/call # 6675 times (4.31ms+0s) by YAML::PP::Parser::cb_mapkey at line 1033, avg 646ns/call # 2056 times (1.26ms+0s) by YAML::PP::Parser::cb_take_quoted at line 1152, avg 610ns/call # 337 times (122µs+0s) by YAML::PP::Parser::start_flow_sequence at line 546, avg 362ns/call # 308 times (178µs+0s) by YAML::PP::Parser::start_sequence at line 521, avg 578ns/call # 214 times (107µs+0s) by YAML::PP::Parser::start_flow_mapping at line 570, avg 500ns/call # 29 times (24µs+0s) by YAML::PP::Parser::cb_flowkey_plain at line 1280, avg 828ns/call # once (2µs+0s) by YAML::PP::Parser::cb_send_block_scalar at line 1409 # once (0s+0s) by YAML::PP::Parser::cb_send_block_scalar at line 1420
sub event_stack { return $_[0]->{event_stack} }
8713µs
# spent 1µs within YAML::PP::Parser::set_event_stack which was called: # once (1µs+0s) by YAML::PP::Parser::init at line 112
sub set_event_stack { $_[0]->{event_stack} = $_[1] }
8812µs
# spent 1µs within YAML::PP::Parser::default_yaml_version which was called: # once (1µs+0s) by YAML::PP::Parser::init at line 113
sub default_yaml_version { return $_[0]->{default_yaml_version} }
8912µs
# spent 1µs within YAML::PP::Parser::yaml_version which was called: # once (1µs+0s) by YAML::PP::Parser::end_document at line 653
sub yaml_version { return $_[0]->{yaml_version} }
9012µs
# spent 1µs within YAML::PP::Parser::set_yaml_version which was called: # once (1µs+0s) by YAML::PP::Parser::init at line 113
sub set_yaml_version { $_[0]->{yaml_version} = $_[1] }
9112µs
# spent 2µs within YAML::PP::Parser::yaml_version_directive which was called: # once (2µs+0s) by YAML::PP::Parser::start_document at line 495
sub yaml_version_directive { return $_[0]->{yaml_version_directive} }
9229µs
# spent 6µs within YAML::PP::Parser::set_yaml_version_directive which was called 2 times, avg 3µs/call: # once (5µs+0s) by YAML::PP::Parser::init at line 114 # once (1µs+0s) by YAML::PP::Parser::start_document at line 506
sub set_yaml_version_directive { $_[0]->{yaml_version_directive} = $_[1] }
93
941345024.1ms
# spent 12.4ms within YAML::PP::Parser::rule which was called 13450 times, avg 923ns/call: # 13449 times (12.4ms+0s) by YAML::PP::Parser::parse_tokens at line 437, avg 923ns/call # once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 358
sub rule { return $_[0]->{rule} }
95
# spent 62.3ms within YAML::PP::Parser::set_rule which was called 55080 times, avg 1µs/call: # 46809 times (53.3ms+0s) by YAML::PP::Parser::parse_tokens at line 408, avg 1µs/call # 6992 times (7.83ms+0s) by YAML::PP::Parser::parse_tokens at line 434, avg 1µs/call # 1275 times (1.12ms+0s) by YAML::PP::Parser::parse_tokens at line 415, avg 877ns/call # once (2µs+0s) by YAML::PP::Parser::end_document at line 659 # once (2µs+0s) by YAML::PP::Parser::start_document at line 507 # once (1µs+0s) by YAML::PP::Parser::init at line 111 # once (1µs+0s) by YAML::PP::Parser::parse at line 154
sub set_rule {
965508020.2ms my ($self, $name) = @_;
9724.90ms259µs
# spent 35µs (11+24) within YAML::PP::Parser::BEGIN@97 which was called: # once (11µs+24µs) by YAML::PP::Loader::BEGIN@8 at line 97
no warnings 'uninitialized';
# spent 35µs making 1 call to YAML::PP::Parser::BEGIN@97 # spent 24µs making 1 call to warnings::unimport
98 DEBUG and $self->info("set_rule($name)");
995508093.6ms $self->{rule} = $name;
100}
101
102
# spent 74µs (45+29) within YAML::PP::Parser::init which was called: # once (45µs+29µs) by YAML::PP::Parser::parse at line 150
sub init {
10310s my ($self) = @_;
10413µs13µs $self->set_offset([]);
# spent 3µs making 1 call to YAML::PP::Parser::set_offset
10511µs10s $self->set_events([]);
# spent 0s making 1 call to YAML::PP::Parser::set_events
10612µs15µs $self->set_new_node(0);
# spent 5µs making 1 call to YAML::PP::Parser::set_new_node
10712µs12µs $self->set_tagmap({
# spent 2µs making 1 call to YAML::PP::Parser::set_tagmap
108 '!!' => "tag:yaml.org,2002:",
109 });
11011µs12µs $self->set_tokens([]);
# spent 2µs making 1 call to YAML::PP::Parser::set_tokens
11112µs11µs $self->set_rule(undef);
# spent 1µs making 1 call to YAML::PP::Parser::set_rule
11211µs11µs $self->set_event_stack([]);
# spent 1µs making 1 call to YAML::PP::Parser::set_event_stack
11315µs22µs $self->set_yaml_version($self->default_yaml_version);
# spent 1µs making 1 call to YAML::PP::Parser::default_yaml_version # spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version
11411µs15µs $self->set_yaml_version_directive(undef);
# spent 5µs making 1 call to YAML::PP::Parser::set_yaml_version_directive
115111µs28µs $self->lexer->init;
# spent 7µs making 1 call to YAML::PP::Lexer::init # spent 1µs making 1 call to YAML::PP::Parser::lexer
116}
117
118sub parse_string {
119 my ($self, $yaml) = @_;
120 $self->set_reader(YAML::PP::Reader->new( input => $yaml ));
121 $self->parse();
122}
123
124sub parse_file {
125 my ($self, $file) = @_;
126 $self->set_reader(YAML::PP::Reader::File->new( input => $file ));
127 $self->parse();
128}
129
13016µsmy %nodetypes = (
131 MAPVALUE => 'NODETYPE_COMPLEX',
132 MAP => 'NODETYPE_MAP',
133# IMAP => 'NODETYPE_SEQ',
134 SEQ => 'NODETYPE_SEQ',
135 SEQ0 => 'NODETYPE_SEQ',
136 FLOWMAP => 'NODETYPE_FLOWMAP',
137 FLOWMAPVALUE => 'NODETYPE_FLOWMAPVALUE',
138 FLOWSEQ => 'NODETYPE_FLOWSEQ',
139 FLOWSEQ_NEXT => 'FLOWSEQ_NEXT',
140 DOC => 'FULLNODE',
141 DOC_END => 'DOCUMENT_END',
142 STR => 'STREAM',
143 END_FLOW => 'END_FLOW',
144);
145
146
# spent 7.34s (37µs+7.34) within YAML::PP::Parser::parse which was called: # once (37µs+7.34s) by YAML::PP::Loader::load at line 94 of YAML/PP/Loader.pm
sub parse {
14711µs my ($self) = @_;
148 TRACE and warn "=== parse()\n";
149 TRACE and $self->debug_yaml;
15013µs174µs $self->init;
# spent 74µs making 1 call to YAML::PP::Parser::init
15111µs21µs $self->lexer->init;
# spent 1µs making 1 call to YAML::PP::Lexer::init # spent 0s making 1 call to YAML::PP::Parser::lexer
15211µs eval {
15314µs132µs $self->start_stream;
# spent 32µs making 1 call to YAML::PP::Parser::start_stream
15411µs11µs $self->set_rule( 'STREAM' );
# spent 1µs making 1 call to YAML::PP::Parser::set_rule
155
15612µs17.34s $self->parse_tokens();
# spent 7.34s making 1 call to YAML::PP::Parser::parse_tokens
157
15812µs119µs $self->end_stream;
# spent 19µs making 1 call to YAML::PP::Parser::end_stream
159 };
16011µs if (my $error = $@) {
161 if (ref $error) {
162 croak "$error\n ";
163 }
164 croak $error;
165 }
166
167 DEBUG and $self->highlight_yaml;
16813µs TRACE and $self->debug_tokens;
169}
170
171
# spent 1.85s (304ms+1.55) within YAML::PP::Parser::lex_next_tokens which was called 13451 times, avg 138µs/call: # 13450 times (304ms+1.54s) by YAML::PP::Parser::parse_tokens at line 423, avg 137µs/call # once (18µs+5.03ms) by YAML::PP::Parser::parse_tokens at line 346
sub lex_next_tokens {
172134513.71ms my ($self) = @_;
173
174 DEBUG and $self->info("----------------> lex_next_tokens");
175 TRACE and $self->debug_events;
176
1771345114.3ms134517.95ms my $indent = $self->offset->[-1];
# spent 7.95ms making 13451 calls to YAML::PP::Parser::offset, avg 591ns/call
178134519.42ms134516.08ms my $event_types = $self->events;
# spent 6.08ms making 13451 calls to YAML::PP::Parser::events, avg 452ns/call
1791345131.5ms269021.18s my $next_tokens = $self->lexer->fetch_next_tokens($indent);
# spent 1.17s making 13451 calls to YAML::PP::Lexer::fetch_next_tokens, avg 87µs/call # spent 7.15ms making 13451 calls to YAML::PP::Parser::lexer, avg 532ns/call
180134512.69ms return unless @$next_tokens;
181
182134503.84ms my $next = $next_tokens->[0];
183
184134505.39ms return 1 if ($next->{name} ne 'SPACE');
1851344928.3ms134495.83ms my $flow = $event_types->[-1] =~ m/^FLOW/;
# spent 5.83ms making 13449 calls to YAML::PP::Parser::CORE:match, avg 434ns/call
186134497.55ms my $space = length $next->{value};
1871344914.8ms1344911.3ms my $tokens = $self->tokens;
# spent 11.3ms making 13449 calls to YAML::PP::Parser::tokens, avg 838ns/call
188
189134495.66ms if (not $space) {
190 shift @$next_tokens;
191 }
192 else {
193134445.14ms push @$tokens, shift @$next_tokens;
194 }
195134492.18ms if ($flow) {
196 if ($space >= $indent) {
197 return 1;
198 }
199 $self->exception("Bad indendation in " . $self->events->[-1]);
200 }
201134493.15ms $next = $next_tokens->[0];
202134494.26ms if ($space > $indent ) {
20361492.20ms return 1 if $indent < 0;
20461485.38ms61483.60ms unless ($self->new_node) {
# spent 3.60ms making 6148 calls to YAML::PP::Parser::new_node, avg 586ns/call
205 $self->exception("Bad indendation in " . $self->events->[-1]);
206 }
207614813.2ms return 1;
208 }
20973009.23ms73004.85ms if ($self->new_node) {
# spent 4.85ms making 7300 calls to YAML::PP::Parser::new_node, avg 664ns/call
210308214µs if ($space < $indent) {
211 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
212 $self->remove_nodes($space);
213 }
214 else {
215 # unindented sequence starts
216308522µs308174µs my $exp = $self->events->[-1];
# spent 174µs making 308 calls to YAML::PP::Parser::events, avg 565ns/call
217308146µs my $seq_start = $next->{name} eq 'DASH';
218308211µs if ( $seq_start and ($exp eq 'MAPVALUE' or $exp eq 'MAP')) {
219 }
220 else {
221 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
222 }
223 }
224 }
225 else {
22669926.09ms2815317ms if ($space < $indent) {
# spent 317ms making 2815 calls to YAML::PP::Parser::remove_nodes, avg 113µs/call
227 $self->remove_nodes($space);
228 }
229 }
230
23173009.04ms73003.98ms my $exp = $self->events->[-1];
# spent 3.98ms making 7300 calls to YAML::PP::Parser::events, avg 545ns/call
232
23373003.71ms if ($exp eq 'SEQ0' and $next->{name} ne 'DASH') {
234 TRACE and $self->info("In unindented sequence");
235262380µs2629.77ms $self->end_sequence;
# spent 9.77ms making 262 calls to YAML::PP::Parser::end_sequence, avg 37µs/call
236262297µs262141µs $exp = $self->events->[-1];
# spent 141µs making 262 calls to YAML::PP::Parser::events, avg 538ns/call
237 }
238
23973008.50ms73003.41ms if ($self->offset->[-1] != $space) {
# spent 3.41ms making 7300 calls to YAML::PP::Parser::offset, avg 467ns/call
240 $self->exception("Expected " . $self->events->[-1]);
241 }
242730016.1ms return 1;
243}
244
24513µsmy %next_event = (
246 MAP => 'MAPVALUE',
247 IMAP => 'IMAPVALUE',
248 MAPVALUE => 'MAP',
249 IMAPVALUE => 'IMAP',
250 SEQ => 'SEQ',
251 SEQ0 => 'SEQ0',
252 DOC => 'DOC_END',
253 STR => 'STR',
254 FLOWSEQ => 'FLOWSEQ_NEXT',
255 FLOWSEQ_NEXT => 'FLOWSEQ',
256 FLOWMAP => 'FLOWMAPVALUE',
257 FLOWMAPVALUE => 'FLOWMAP',
258);
259
26011µsmy %event_to_method = (
261 MAP => 'mapping',
262 IMAP => 'mapping',
263 FLOWMAP => 'mapping',
264 SEQ => 'sequence',
265 SEQ0 => 'sequence',
266 FLOWSEQ => 'sequence',
267 DOC => 'document',
268 STR => 'stream',
269 VAL => 'scalar',
270 ALI => 'alias',
271 MAPVALUE => 'mapping',
272 IMAPVALUE => 'mapping',
273);
274
275#sub process_events {
276# my ($self, $res) = @_;
277#
278# my $event_stack = $self->event_stack;
279# return unless @$event_stack;
280#
281# if (@$event_stack == 1 and $event_stack->[0]->[0] eq 'properties') {
282# return;
283# }
284#
285# my $event_types = $self->events;
286# my $properties;
287# my @send_events;
288# for my $event (@$event_stack) {
289# TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$event], ['event']);
290# my ($type, $info) = @$event;
291# if ($type eq 'properties') {
292# $properties = $info;
293# }
294# elsif ($type eq 'scalar') {
295# $info->{name} = 'scalar_event';
296# $event_types->[-1] = $next_event{ $event_types->[-1] };
297# push @send_events, $info;
298# }
299# elsif ($type eq 'begin') {
300# my $name = $info->{name};
301# $info->{name} = $event_to_method{ $name } . '_start_event';
302# push @{ $event_types }, $name;
303# push @{ $self->offset }, $info->{offset};
304# push @send_events, $info;
305# }
306# elsif ($type eq 'end') {
307# my $name = $info->{name};
308# $info->{name} = $event_to_method{ $name } . '_end_event';
309# $self->$type($name, $info);
310# push @send_events, $info;
311# if (@$event_types) {
312# $event_types->[-1] = $next_event{ $event_types->[-1] };
313# }
314# }
315# elsif ($type eq 'alias') {
316# if ($properties) {
317# $self->exception("Parse error: Alias not allowed in this context");
318# }
319# $info->{name} = 'alias_event';
320# $event_types->[-1] = $next_event{ $event_types->[-1] };
321# push @send_events, $info;
322# }
323# }
324# @$event_stack = ();
325# for my $info (@send_events) {
326# DEBUG and $self->debug_event( $info );
327# $self->callback->($self, $info->{name}, $info);
328# }
329#}
330
33112µsmy %fetch_method = (
332 '"' => 'fetch_quoted',
333 "'" => 'fetch_quoted',
334 '|' => 'fetch_block',
335 '>' => 'fetch_block',
336 '' => 'fetch_plain',
337);
338
339
# spent 7.34s (894ms+6.45) within YAML::PP::Parser::parse_tokens which was called: # once (894ms+6.45s) by YAML::PP::Parser::parse at line 156
sub parse_tokens {
34010s my ($self) = @_;
34112µs10s my $event_types = $self->events;
# spent 0s making 1 call to YAML::PP::Parser::events
34211µs10s my $offsets = $self->offset;
# spent 0s making 1 call to YAML::PP::Parser::offset
34311µs11µs my $tokens = $self->tokens;
# spent 1µs making 1 call to YAML::PP::Parser::tokens
34412µs21µs my $next_tokens = $self->lexer->next_tokens;
# spent 1µs making 1 call to YAML::PP::Lexer::next_tokens # spent 0s making 1 call to YAML::PP::Parser::lexer
345
34612µs15.05ms unless ($self->lex_next_tokens) {
# spent 5.05ms making 1 call to YAML::PP::Parser::lex_next_tokens
347 $self->end_document(1);
348 return 0;
349 }
35013µs12µs unless ($self->new_node) {
# spent 2µs making 1 call to YAML::PP::Parser::new_node
35112µs12µs if ($self->level > 0) {
# spent 2µs making 1 call to YAML::PP::Parser::level
352 my $new_rule = $nodetypes{ $event_types->[-1] }
353 or die "Did not find '$event_types->[-1]'";
354 $self->set_rule( $new_rule );
355 }
356 }
357
35812µs11µs my $rule_name = $self->rule;
# spent 1µs making 1 call to YAML::PP::Parser::rule
359 DEBUG and $self->info("----------------> parse_tokens($rule_name)");
36012µs my $rule = $GRAMMAR->{ $rule_name }
361 or die "Could not find rule $rule_name";
362
363 TRACE and $self->debug_rules($rule);
364 TRACE and $self->debug_yaml;
365 DEBUG and $self->debug_next_line;
366
36719.35ms RULE: while ($rule_name) {
368 DEBUG and $self->info("RULE: $rule_name");
369 TRACE and $self->debug_tokens($next_tokens);
370
37111098516.0ms unless (@$next_tokens) {
372 $self->exception("No more tokens");
373 }
374 TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$next_tokens->[0]], ['next_token']);
37511098532.2ms my $got = $next_tokens->[0]->{name};
37611098517.2ms if ($got eq 'CONTEXT') {
377209415.39ms my $context = shift @$next_tokens;
378209414.06ms my $indent = $offsets->[-1];
3792094135.3ms4188224.9ms $indent++ unless $self->lexer->flowcontext;
# spent 13.4ms making 20941 calls to YAML::PP::Parser::lexer, avg 641ns/call # spent 11.5ms making 20941 calls to YAML::PP::Lexer::flowcontext, avg 550ns/call
3802094111.0ms my $method = $fetch_method{ $context->{value} };
3812094139.1ms418822.34s my $partial = $self->lexer->$method($indent, $context->{value});
# spent 2.06s making 18884 calls to YAML::PP::Lexer::fetch_plain, avg 109µs/call # spent 275ms making 2056 calls to YAML::PP::Lexer::fetch_quoted, avg 134µs/call # spent 8.28ms making 20941 calls to YAML::PP::Parser::lexer, avg 396ns/call # spent 550µs making 1 call to YAML::PP::Lexer::fetch_block
3822094128.9ms next RULE;
383 }
3849004435.9ms my $def = $rule->{ $got };
3859004438.7ms if ($def) {
386 push @$tokens, shift @$next_tokens;
387 }
388 elsif ($def = $rule->{DEFAULT}) {
389 $got = 'DEFAULT';
390 }
391 else {
392 $self->expected(
393 expected => [keys %$rule],
394 got => $next_tokens->[0],
395 );
396 }
397
398 DEBUG and $self->got("---got $got");
3999004442.8ms if (my $sub = $def->{match}) {
400 DEBUG and $self->info("CALLBACK $sub");
4014377066.7ms437702.13s $self->$sub(@$tokens ? $tokens->[-1] : ());
# spent 904ms making 6725 calls to YAML::PP::Parser::cb_insert_map, avg 134µs/call # spent 502ms making 6675 calls to YAML::PP::Parser::cb_send_mapkey, avg 75µs/call # spent 423ms making 6470 calls to YAML::PP::Parser::cb_send_scalar, avg 65µs/call # spent 72.2ms making 12180 calls to YAML::PP::Parser::cb_start_plain, avg 6µs/call # spent 56.5ms making 689 calls to YAML::PP::Parser::cb_flow_comma, avg 82µs/call # spent 46.3ms making 6675 calls to YAML::PP::Parser::cb_mapkey, avg 7µs/call # spent 41.3ms making 337 calls to YAML::PP::Parser::cb_end_flowseq, avg 123µs/call # spent 19.3ms making 337 calls to YAML::PP::Parser::cb_start_flowseq, avg 57µs/call # spent 17.1ms making 2041 calls to YAML::PP::Parser::cb_take_quoted, avg 8µs/call # spent 17.0ms making 308 calls to YAML::PP::Parser::cb_seqstart, avg 55µs/call # spent 13.9ms making 214 calls to YAML::PP::Parser::cb_start_flowmap, avg 65µs/call # spent 12.1ms making 214 calls to YAML::PP::Parser::cb_end_flowmap, avg 56µs/call # spent 3.39ms making 29 calls to YAML::PP::Parser::cb_flowkey_plain, avg 117µs/call # spent 2.81ms making 528 calls to YAML::PP::Parser::cb_end_outer_flow, avg 5µs/call # spent 1.37ms making 302 calls to YAML::PP::Parser::cb_seqitem, avg 5µs/call # spent 909µs making 15 calls to YAML::PP::Parser::cb_take_quoted_key, avg 61µs/call # spent 209µs making 1 call to YAML::PP::Parser::cb_send_block_scalar # spent 129µs making 29 calls to YAML::PP::Parser::cb_flow_colon, avg 4µs/call # spent 56µs making 1 call to YAML::PP::Parser::cb_doc_start_explicit
402 }
4039004419.7ms my $eol = $got eq 'EOL';
4049004426.2ms my $new = $def->{new};
4059004427.3ms if ($new) {
406 DEBUG and $self->got("NEW: $new");
407468098.14ms $rule_name = $new;
4084680938.5ms4680953.3ms $self->set_rule($rule_name);
# spent 53.3ms making 46809 calls to YAML::PP::Parser::set_rule, avg 1µs/call
409 }
410 elsif ($eol) {
411 }
412 elsif ($def->{return}) {
41312751.03ms $rule_name = $nodetypes{ $event_types->[-1] }
414 or die "Unexpected event type $event_types->[-1]";
41512751.03ms12751.12ms $self->set_rule($rule_name);
# spent 1.12ms making 1275 calls to YAML::PP::Parser::set_rule, avg 877ns/call
416 }
417 else {
4183496719.3ms $rule_name .= " - $got"; # for debugging
419349675.12ms $rule = $def;
4203496712.8ms next RULE;
421 }
4225507710.5ms if ($eol) {
4231345016.1ms134501.85s unless ($self->lex_next_tokens) {
# spent 1.85s making 13450 calls to YAML::PP::Parser::lex_next_tokens, avg 137µs/call
42410s if ($rule_name eq 'DIRECTIVE') {
425 $self->exception("Directive needs document start");
426 }
42712µs11.33ms $self->end_document(1);
# spent 1.33ms making 1 call to YAML::PP::Parser::end_document
42815µs return 0;
429 }
4301344911.3ms134496.34ms unless ($self->new_node) {
# spent 6.34ms making 13449 calls to YAML::PP::Parser::new_node, avg 472ns/call
431699210.4ms699210.0ms if ($self->level > 0) {
# spent 10.0ms making 6992 calls to YAML::PP::Parser::level, avg 1µs/call
43269925.79ms $rule_name = $nodetypes{ $event_types->[-1] }
433 or die "Did not find '$event_types->[-1]'";
43469925.53ms69927.83ms $self->set_rule( $rule_name );
# spent 7.83ms making 6992 calls to YAML::PP::Parser::set_rule, avg 1µs/call
435 }
436 }
4371344917.3ms1344912.4ms $rule_name = $self->rule;
# spent 12.4ms making 13449 calls to YAML::PP::Parser::rule, avg 923ns/call
438 }
4395507653.0ms $rule = $GRAMMAR->{ $rule_name }
440 or die "Unexpected rule $rule_name";
441
442 }
443
444 die "Unexpected";
445}
446
447
# spent 9.77ms (3.63+6.14) within YAML::PP::Parser::end_sequence which was called 262 times, avg 37µs/call: # 262 times (3.63ms+6.14ms) by YAML::PP::Parser::lex_next_tokens at line 235, avg 37µs/call
sub end_sequence {
448262124µs my ($self) = @_;
449262261µs262118µs my $event_types = $self->events;
# spent 118µs making 262 calls to YAML::PP::Parser::events, avg 450ns/call
450262106µs pop @{ $event_types };
451262249µs262103µs pop @{ $self->offset };
# spent 103µs making 262 calls to YAML::PP::Parser::offset, avg 393ns/call
452262415µs my $info = { name => 'sequence_end_event' };
453262429µs5245.91ms $self->callback->($self, $info->{name} => $info );
# spent 5.79ms making 262 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 22µs/call # spent 126µs making 262 calls to YAML::PP::Parser::callback, avg 481ns/call
454262861µs $event_types->[-1] = $next_event{ $event_types->[-1] };
455}
456
457
# spent 319ms (72.0+247) within YAML::PP::Parser::remove_nodes which was called 2816 times, avg 113µs/call: # 2815 times (71.9ms+245ms) by YAML::PP::Parser::lex_next_tokens at line 226, avg 113µs/call # once (40µs+1.22ms) by YAML::PP::Parser::end_document at line 639
sub remove_nodes {
45828161.19ms my ($self, $space) = @_;
45928162.88ms28161.52ms my $offset = $self->offset;
# spent 1.52ms making 2816 calls to YAML::PP::Parser::offset, avg 541ns/call
46028162.46ms28161.32ms my $event_types = $self->events;
# spent 1.32ms making 2816 calls to YAML::PP::Parser::events, avg 469ns/call
461
46228161.25ms my $exp = $event_types->[-1];
46328161.16ms while (@$offset) {
46495873.03ms if ($offset->[ -1 ] <= $space) {
46528161.17ms last;
466 }
46767711.73ms if ($exp eq 'MAPVALUE') {
468 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
469 $exp = 'MAP';
470 }
47167715.42ms my $info = { name => $exp };
47267714.86ms $info->{name} = $event_to_method{ $exp } . '_end_event';
47367712.25ms pop @{ $event_types };
47467711.42ms pop @{ $offset };
475677111.2ms13542244ms $self->callback->($self, $info->{name} => $info );
# spent 240ms making 6771 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 35µs/call # spent 3.81ms making 6771 calls to YAML::PP::Parser::callback, avg 562ns/call
47667714.74ms $event_types->[-1] = $next_event{ $event_types->[-1] };
47767716.53ms $exp = $event_types->[-1];
478 }
47928165.72ms return $exp;
480}
481
482
# spent 32µs (17+15) within YAML::PP::Parser::start_stream which was called: # once (17µs+15µs) by YAML::PP::Parser::parse at line 153
sub start_stream {
48310s my ($self) = @_;
48413µs12µs push @{ $self->events }, 'STR';
# spent 2µs making 1 call to YAML::PP::Parser::events
48512µs11µs push @{ $self->offset }, -1;
# spent 1µs making 1 call to YAML::PP::Parser::offset
48616µs212µs $self->callback->($self, 'stream_start_event', {
# spent 7µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62] # spent 5µs making 1 call to YAML::PP::Parser::callback
487 name => 'stream_start_event',
488 });
489}
490
491
# spent 51µs (26+25) within YAML::PP::Parser::start_document which was called: # once (26µs+25µs) by YAML::PP::Parser::cb_doc_start_explicit at line 1441
sub start_document {
49210s my ($self, $implicit) = @_;
49313µs12µs push @{ $self->events }, 'DOC';
# spent 2µs making 1 call to YAML::PP::Parser::events
49411µs10s push @{ $self->offset }, -1;
# spent 0s making 1 call to YAML::PP::Parser::offset
49511µs12µs my $directive = $self->yaml_version_directive;
# spent 2µs making 1 call to YAML::PP::Parser::yaml_version_directive
49611µs my %directive;
49710s if ($directive) {
498 my ($major, $minor) = split m/\./, $self->yaml_version;
499 %directive = ( version_directive => { major => $major, minor => $minor } );
500 }
50114µs217µs $self->callback->($self, 'document_start_event', {
# spent 16µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62] # spent 1µs making 1 call to YAML::PP::Parser::callback
502 name => 'document_start_event',
503 implicit => $implicit,
504 %directive,
505 });
50611µs11µs $self->set_yaml_version_directive(undef);
# spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version_directive
50711µs12µs $self->set_rule( 'FULLNODE' );
# spent 2µs making 1 call to YAML::PP::Parser::set_rule
50816µs11µs $self->set_new_node(1);
# spent 1µs making 1 call to YAML::PP::Parser::set_new_node
509}
510
511
# spent 14.8ms (4.39+10.4) within YAML::PP::Parser::start_sequence which was called 308 times, avg 48µs/call: # 308 times (4.39ms+10.4ms) by YAML::PP::Parser::cb_seqstart at line 1140, avg 48µs/call
sub start_sequence {
512308142µs my ($self, $offset) = @_;
513308363µs308184µs my $offsets = $self->offset;
# spent 184µs making 308 calls to YAML::PP::Parser::offset, avg 597ns/call
514308633µs308138µs if ($offsets->[-1] == $offset) {
# spent 138µs making 308 calls to YAML::PP::Parser::events, avg 448ns/call
515 push @{ $self->events }, 'SEQ0';
516 }
517 else {
518 push @{ $self->events }, 'SEQ';
519 }
520308151µs push @{ $offsets }, $offset;
521308378µs308178µs my $event_stack = $self->event_stack;
# spent 178µs making 308 calls to YAML::PP::Parser::event_stack, avg 578ns/call
522308305µs my $info = { name => 'sequence_start_event' };
52330880µs if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
524 my $properties = pop @$event_stack;
525 $self->node_properties($properties->[1], $info);
526 }
5273081.06ms6169.92ms $self->callback->($self, 'sequence_start_event', $info);
# spent 9.79ms making 308 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 32µs/call # spent 134µs making 308 calls to YAML::PP::Parser::callback, avg 435ns/call
528}
529
530
# spent 18.1ms (7.22+10.8) within YAML::PP::Parser::start_flow_sequence which was called 337 times, avg 54µs/call: # 337 times (7.22ms+10.8ms) by YAML::PP::Parser::cb_start_flowseq at line 1221, avg 54µs/call
sub start_flow_sequence {
531337116µs my ($self, $offset) = @_;
532337361µs337209µs my $offsets = $self->offset;
# spent 209µs making 337 calls to YAML::PP::Parser::offset, avg 620ns/call
533337135µs my $new_offset = $offsets->[-1];
534337341µs337149µs my $event_types = $self->events;
# spent 149µs making 337 calls to YAML::PP::Parser::events, avg 442ns/call
535337615µs337165µs if ($new_offset < 0) {
# spent 165µs making 337 calls to YAML::PP::Parser::new_node, avg 490ns/call
536 $new_offset = 0;
537 }
538 elsif ($self->new_node) {
539337880µs337211µs if ($event_types->[-1] !~ m/^FLOW/) {
# spent 211µs making 337 calls to YAML::PP::Parser::CORE:match, avg 626ns/call
540 $new_offset++;
541 }
542 }
543337432µs337124µs push @{ $self->events }, 'FLOWSEQ';
# spent 124µs making 337 calls to YAML::PP::Parser::events, avg 368ns/call
544337147µs push @{ $offsets }, $new_offset;
545
546337332µs337122µs my $event_stack = $self->event_stack;
# spent 122µs making 337 calls to YAML::PP::Parser::event_stack, avg 362ns/call
547337492µs my $info = { style => YAML_FLOW_SEQUENCE_STYLE, name => 'sequence_start_event' };
548337191µs if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
549 $self->fetch_inline_properties($event_stack, $info);
550 }
5513371.11ms6749.85ms $self->callback->($self, 'sequence_start_event', $info);
# spent 9.71ms making 337 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 29µs/call # spent 140µs making 337 calls to YAML::PP::Parser::callback, avg 415ns/call
552}
553
554
# spent 12.9ms (4.98+7.87) within YAML::PP::Parser::start_flow_mapping which was called 214 times, avg 60µs/call: # 214 times (4.98ms+7.87ms) by YAML::PP::Parser::cb_start_flowmap at line 1226, avg 60µs/call
sub start_flow_mapping {
555214102µs my ($self, $offset, $implicit_flowseq_map) = @_;
556214225µs214129µs my $offsets = $self->offset;
# spent 129µs making 214 calls to YAML::PP::Parser::offset, avg 603ns/call
557214146µs my $new_offset = $offsets->[-1];
558214265µs214114µs my $event_types = $self->events;
# spent 114µs making 214 calls to YAML::PP::Parser::events, avg 533ns/call
559214349µs214111µs if ($new_offset < 0) {
# spent 111µs making 214 calls to YAML::PP::Parser::new_node, avg 519ns/call
560 $new_offset = 0;
561 }
562 elsif ($self->new_node) {
563214520µs214153µs if ($event_types->[-1] !~ m/^FLOW/) {
# spent 153µs making 214 calls to YAML::PP::Parser::CORE:match, avg 715ns/call
564 $new_offset++;
565 }
566 }
567214403µs214117µs push @{ $self->events }, $implicit_flowseq_map ? 'IMAP' : 'FLOWMAP';
# spent 117µs making 214 calls to YAML::PP::Parser::events, avg 547ns/call
56821479µs push @{ $offsets }, $new_offset;
569
570214172µs214107µs my $event_stack = $self->event_stack;
# spent 107µs making 214 calls to YAML::PP::Parser::event_stack, avg 500ns/call
571214261µs my $info = { name => 'mapping_start_event', style => YAML_FLOW_MAPPING_STYLE };
57221466µs if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
573 $self->fetch_inline_properties($event_stack, $info);
574 }
5752141.03ms4287.14ms $self->callback->($self, 'mapping_start_event', $info);
# spent 7.02ms making 214 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 33µs/call # spent 120µs making 214 calls to YAML::PP::Parser::callback, avg 561ns/call
576}
577
578
# spent 14.8ms (4.90+9.95) within YAML::PP::Parser::end_flow_sequence which was called 337 times, avg 44µs/call: # 337 times (4.90ms+9.95ms) by YAML::PP::Parser::cb_end_flowseq at line 1232, avg 44µs/call
sub end_flow_sequence {
579337178µs my ($self) = @_;
580337301µs337128µs my $event_types = $self->events;
# spent 128µs making 337 calls to YAML::PP::Parser::events, avg 380ns/call
581337219µs pop @{ $event_types };
582337528µs337265µs pop @{ $self->offset };
# spent 265µs making 337 calls to YAML::PP::Parser::offset, avg 786ns/call
583337319µs my $info = { name => 'sequence_end_event' };
584337621µs6748.75ms $self->callback->($self, $info->{name}, $info);
# spent 8.62ms making 337 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 26µs/call # spent 139µs making 337 calls to YAML::PP::Parser::callback, avg 412ns/call
5853372.18ms337800µs if ($event_types->[-1] =~ m/^FLOW|^IMAP/) {
# spent 800µs making 337 calls to YAML::PP::Parser::CORE:match, avg 2µs/call
586 $event_types->[-1] = $next_event{ $event_types->[-1] };
587 }
588 else {
589314201µs push @$event_types, 'END_FLOW';
590 }
591}
592
593
# spent 10.5ms (3.24+7.28) within YAML::PP::Parser::end_flow_mapping which was called 214 times, avg 49µs/call: # 214 times (3.24ms+7.28ms) by YAML::PP::Parser::cb_end_flowmap at line 1267, avg 49µs/call
sub end_flow_mapping {
59421476µs my ($self) = @_;
595214232µs214119µs my $event_types = $self->events;
# spent 119µs making 214 calls to YAML::PP::Parser::events, avg 556ns/call
596214105µs pop @{ $event_types };
597214237µs21488µs pop @{ $self->offset };
# spent 88µs making 214 calls to YAML::PP::Parser::offset, avg 411ns/call
598214209µs my $info = { name => 'mapping_end_event' };
599214437µs4286.57ms $self->callback->($self, $info->{name}, $info);
# spent 6.47ms making 214 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 30µs/call # spent 103µs making 214 calls to YAML::PP::Parser::callback, avg 481ns/call
6002141.55ms214504µs if ($event_types->[-1] =~ m/^FLOW|^IMAP/) {
# spent 504µs making 214 calls to YAML::PP::Parser::CORE:match, avg 2µs/call
601 $event_types->[-1] = $next_event{ $event_types->[-1] };
602 }
603 else {
604214104µs push @$event_types, 'END_FLOW';
605 }
606}
607
608
# spent 2.81ms (2.43+387µs) within YAML::PP::Parser::cb_end_outer_flow which was called 528 times, avg 5µs/call: # 528 times (2.43ms+387µs) by YAML::PP::Parser::parse_tokens at line 401, avg 5µs/call
sub cb_end_outer_flow {
609528192µs my ($self) = @_;
610528627µs528387µs my $event_types = $self->events;
# spent 387µs making 528 calls to YAML::PP::Parser::events, avg 733ns/call
611528220µs pop @$event_types;
6125281.17ms $event_types->[-1] = $next_event{ $event_types->[-1] };
613}
614
615
# spent 300ms (79.2+221) within YAML::PP::Parser::start_mapping which was called 6725 times, avg 45µs/call: # 6725 times (79.2ms+221ms) by YAML::PP::Parser::cb_insert_map at line 1365, avg 45µs/call
sub start_mapping {
61667251.89ms my ($self, $offset) = @_;
61767256.84ms67254.32ms my $offsets = $self->offset;
# spent 4.32ms making 6725 calls to YAML::PP::Parser::offset, avg 643ns/call
61867258.46ms67253.70ms push @{ $self->events }, 'MAP';
# spent 3.70ms making 6725 calls to YAML::PP::Parser::events, avg 550ns/call
61967252.11ms push @{ $offsets }, $offset;
62067254.80ms67252.60ms my $event_stack = $self->event_stack;
# spent 2.60ms making 6725 calls to YAML::PP::Parser::event_stack, avg 387ns/call
62167255.73ms my $info = { name => 'mapping_start_event' };
62267252.05ms if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
623 my $properties = pop @$event_stack;
624 $self->node_properties($properties->[1], $info);
625 }
626672522.8ms13450210ms $self->callback->($self, 'mapping_start_event', $info);
# spent 207ms making 6725 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 31µs/call # spent 3.39ms making 6725 calls to YAML::PP::Parser::callback, avg 505ns/call
627}
628
629
# spent 1.33ms (35µs+1.30) within YAML::PP::Parser::end_document which was called: # once (35µs+1.30ms) by YAML::PP::Parser::parse_tokens at line 427
sub end_document {
63010s my ($self, $implicit) = @_;
631
63211µs10s my $event_types = $self->events;
# spent 0s making 1 call to YAML::PP::Parser::events
63312µs10s if ($event_types->[-1] =~ m/FLOW/) {
# spent 0s making 1 call to YAML::PP::Parser::CORE:match
634 die "Unexpected end of flow context";
635 }
63612µs11µs if ($self->new_node) {
# spent 1µs making 1 call to YAML::PP::Parser::new_node
637 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
638 }
63912µs11.26ms $self->remove_nodes(-1);
# spent 1.26ms making 1 call to YAML::PP::Parser::remove_nodes
640
64111µs if ($event_types->[-1] eq 'STR') {
642 return;
643 }
64411µs my $last = pop @{ $event_types };
64511µs if ($last ne 'DOC' and $last ne 'DOC_END') {
646 $self->exception("Unexpected event type $last");
647 }
64812µs11µs pop @{ $self->offset };
# spent 1µs making 1 call to YAML::PP::Parser::offset
64913µs227µs $self->callback->($self, 'document_end_event', {
# spent 26µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62] # spent 1µs making 1 call to YAML::PP::Parser::callback
650 name => 'document_end_event',
651 implicit => $implicit,
652 });
65313µs23µs if ($self->yaml_version eq '1.2') {
# spent 2µs making 1 call to YAML::PP::Parser::set_tagmap # spent 1µs making 1 call to YAML::PP::Parser::yaml_version
654 # In YAML 1.2, directives are only for the following
655 # document. In YAML 1.1, they are global
656 $self->set_tagmap({ '!!' => "tag:yaml.org,2002:" });
657 }
65811µs $event_types->[-1] = $next_event{ $event_types->[-1] };
65914µs12µs $self->set_rule('STREAM');
# spent 2µs making 1 call to YAML::PP::Parser::set_rule
660}
661
662
# spent 19µs (12+7) within YAML::PP::Parser::end_stream which was called: # once (12µs+7µs) by YAML::PP::Parser::parse at line 158
sub end_stream {
66311µs my ($self) = @_;
66412µs12µs my $last = pop @{ $self->events };
# spent 2µs making 1 call to YAML::PP::Parser::events
66510s $self->exception("Unexpected event type $last") unless $last eq 'STR';
66611µs10s pop @{ $self->offset };
# spent 0s making 1 call to YAML::PP::Parser::offset
66718µs25µs $self->callback->($self, 'stream_end_event', {
# spent 4µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62] # spent 1µs making 1 call to YAML::PP::Parser::callback
668 name => 'stream_end_event',
669 });
670}
671
672sub fetch_inline_properties {
673 my ($self, $stack, $info) = @_;
674 my $properties = $stack->[-1];
675
676 $properties = $properties->[1];
677 my $property_offset;
678 if ($properties) {
679 for my $p (@{ $properties->{inline} }) {
680 my $type = $p->{type};
681 if (exists $info->{ $type }) {
682 $self->exception("A node can only have one $type");
683 }
684 $info->{ $type } = $p->{value};
685 unless (defined $property_offset) {
686 $property_offset = $p->{offset};
687 $info->{offset} = $p->{offset};
688 }
689 }
690 delete $properties->{inline};
691 undef $properties unless $properties->{newline};
692 }
693
694 unless ($properties) {
695 pop @$stack;
696 }
697}
698
699sub node_properties {
700 my ($self, $properties, $info) = @_;
701 if ($properties) {
702 for my $p (@{ $properties->{newline} }) {
703 my $type = $p->{type};
704 if (exists $info->{ $type }) {
705 $self->exception("A node can only have one $type");
706 }
707 $info->{ $type } = $p->{value};
708 }
709 undef $properties;
710 }
711}
712
713
# spent 1.40s (231ms+1.17) within YAML::PP::Parser::scalar_event which was called 20941 times, avg 67µs/call: # 7497 times (82.5ms+340ms) by YAML::PP::Parser::cb_send_scalar at line 1056, avg 56µs/call # 6725 times (76.7ms+450ms) by YAML::PP::Parser::cb_insert_map at line 1366, avg 78µs/call # 6690 times (71.3ms+376ms) by YAML::PP::Parser::cb_send_mapkey at line 1048, avg 67µs/call # 29 times (414µs+2.46ms) by YAML::PP::Parser::cb_flowkey_plain at line 1289, avg 99µs/call
sub scalar_event {
714209414.39ms my ($self, $info) = @_;
7152094117.8ms2094112.1ms my $event_types = $self->events;
# spent 12.1ms making 20941 calls to YAML::PP::Parser::events, avg 576ns/call
7162094115.5ms209418.64ms my $event_stack = $self->event_stack;
# spent 8.64ms making 20941 calls to YAML::PP::Parser::event_stack, avg 412ns/call
717209414.47ms if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
718 my $properties = pop @$event_stack;
719 $properties = $self->node_properties($properties->[1], $info);
720 }
721
722209418.92ms $info->{name} = 'scalar_event';
7232094133.1ms418821.13s $self->callback->($self, 'scalar_event', $info);
# spent 1.12s making 20941 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 54µs/call # spent 10.0ms making 20941 calls to YAML::PP::Parser::callback, avg 479ns/call
7242094119.1ms2094116.4ms $self->set_new_node(0);
# spent 16.4ms making 20941 calls to YAML::PP::Parser::set_new_node, avg 784ns/call
7252094156.8ms $event_types->[-1] = $next_event{ $event_types->[-1] };
726}
727
728sub alias_event {
729 my ($self, $info) = @_;
730 my $event_stack = $self->event_stack;
731 if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
732 $self->exception("Parse error: Alias not allowed in this context");
733 }
734 my $event_types = $self->events;
735 $info->{name} = 'alias_event';
736 $self->callback->($self, 'alias_event', $info);
737 $self->set_new_node(0);
738 $event_types->[-1] = $next_event{ $event_types->[-1] };
739}
740
741sub yaml_to_tokens {
742 my ($class, $type, $input) = @_;
743 my $yp = YAML::PP::Parser->new( receiver => sub {} );
744 my @docs = eval {
745 $type eq 'string' ? $yp->parse_string($input) : $yp->parse_file($input);
746 };
747 my $error = $@;
748
749 my $tokens = $yp->tokens;
750 if ($error) {
751 my $remaining_tokens = $yp->_remaining_tokens;
752 push @$tokens, map { +{ %$_, name => 'ERROR' } } @$remaining_tokens;
753 }
754 return $error, $tokens;
755}
756
757sub _remaining_tokens {
758 my ($self) = @_;
759 my @tokens;
760 my $next = $self->lexer->next_tokens;
761 push @tokens, @$next;
762 my $next_line = $self->lexer->next_line;
763 my $remaining = '';
764 if ($next_line) {
765 if ($self->lexer->offset > 0) {
766 $remaining = $next_line->[1] . $next_line->[2];
767 }
768 else {
769 $remaining = join '', @$next_line;
770 }
771 }
772 $remaining .= $self->reader->read;
773 $remaining = '' unless defined $remaining;
774 push @tokens, { name => "ERROR", value => $remaining };
775 return \@tokens;
776}
777
778# deprecated
779sub event_to_test_suite {
780 # uncoverable subroutine
781 my ($self, $event) = @_; # uncoverable statement
782 if (ref $event eq 'ARRAY') { # uncoverable statement
783 return YAML::PP::Common::event_to_test_suite($event->[1]); # uncoverable statement
784 }
785 return YAML::PP::Common::event_to_test_suite($event); # uncoverable statement
786}
787
788sub debug_events {
789 # uncoverable subroutine
790 my ($self) = @_; # uncoverable statement
791 $self->note("EVENTS: (" # uncoverable statement
792 . join (' | ', @{ $_[0]->events }) . ')' # uncoverable statement
793 );
794 $self->debug_offset; # uncoverable statement
795}
796
797sub debug_offset {
798 # uncoverable subroutine
799 my ($self) = @_; # uncoverable statement
800 $self->note(
801 qq{OFFSET: (}
802 # uncoverable statement count:1
803 # uncoverable statement count:2
804 # uncoverable statement count:3
805 . join (' | ', map { defined $_ ? sprintf "%-3d", $_ : '?' } @{ $_[0]->offset })
806 # uncoverable statement
807 . qq/) level=@{[ $_[0]->level ]}]}/
808 );
809}
810
811sub debug_yaml {
812 # uncoverable subroutine
813 my ($self) = @_; # uncoverable statement
814 my $line = $self->lexer->line; # uncoverable statement
815 $self->note("LINE NUMBER: $line"); # uncoverable statement
816 my $next_tokens = $self->lexer->next_tokens; # uncoverable statement
817 if (@$next_tokens) { # uncoverable statement
818 $self->debug_tokens($next_tokens); # uncoverable statement
819 }
820}
821
822sub debug_next_line {
823 my ($self) = @_;
824 my $next_line = $self->lexer->next_line || [];
825 my $line = $next_line->[0];
826 $line = '' unless defined $line;
827 $line =~ s/( +)$/'·' x length $1/e;
828 $line =~ s/\t/▸/g;
829 $self->note("NEXT LINE: >>$line<<");
830}
831
832sub note {
833 my ($self, $msg) = @_;
834 $self->_colorize_warn(["yellow"], "============ $msg");
835}
836
837sub info {
838 my ($self, $msg) = @_;
839 $self->_colorize_warn(["cyan"], "============ $msg");
840}
841
842sub got {
843 my ($self, $msg) = @_;
844 $self->_colorize_warn(["green"], "============ $msg");
845}
846
847sub _colorize_warn {
848 # uncoverable subroutine
849 my ($self, $colors, $text) = @_; # uncoverable statement
850 require Term::ANSIColor; # uncoverable statement
851 warn Term::ANSIColor::colored($colors, $text), "\n"; # uncoverable statement
852}
853
854sub debug_event {
855 # uncoverable subroutine
856 my ($self, $event) = @_; # uncoverable statement
857 my $str = YAML::PP::Common::event_to_test_suite($event); # uncoverable statement
858 require Term::ANSIColor; # uncoverable statement
859 warn Term::ANSIColor::colored(["magenta"], "============ $str"), "\n"; # uncoverable statement
860}
861
862sub debug_rules {
863 # uncoverable subroutine
864 my ($self, $rules) = @_; # uncoverable statement
865 local $Data::Dumper::Maxdepth = 2; # uncoverable statement
866 $self->note("RULES:"); # uncoverable statement
867 for my $rule ($rules) { # uncoverable statement
868 if (ref $rule eq 'ARRAY') { # uncoverable statement
869 my $first = $rule->[0]; # uncoverable statement
870 if (ref $first eq 'SCALAR') { # uncoverable statement
871 $self->info("-> $$first"); # uncoverable statement
872 }
873 else { # uncoverable statement
874 if (ref $first eq 'ARRAY') { # uncoverable statement
875 $first = $first->[0]; # uncoverable statement
876 }
877 $self->info("TYPE $first"); # uncoverable statement
878 }
879 }
880 else { # uncoverable statement
881 eval { # uncoverable statement
882 my @keys = sort keys %$rule; # uncoverable statement
883 $self->info("@keys"); # uncoverable statement
884 };
885 }
886 }
887}
888
889sub debug_tokens {
890 # uncoverable subroutine
891 my ($self, $tokens) = @_; # uncoverable statement
892 $tokens ||= $self->tokens; # uncoverable statement
893 require Term::ANSIColor; # uncoverable statement
894 for my $token (@$tokens) { # uncoverable statement
895 my $type = Term::ANSIColor::colored(["green"], # uncoverable statement
896 sprintf "%-22s L %2d C %2d ", # uncoverable statement
897 $token->{name}, $token->{line}, $token->{column} + 1 # uncoverable statement
898 );
899 local $Data::Dumper::Useqq = 1; # uncoverable statement
900 local $Data::Dumper::Terse = 1; # uncoverable statement
901 require Data::Dumper; # uncoverable statement
902 my $str = Data::Dumper->Dump([$token->{value}], ['str']); # uncoverable statement
903 chomp $str; # uncoverable statement
904 $str =~ s/(^.|.$)/Term::ANSIColor::colored(['blue'], $1)/ge; # uncoverable statement
905 warn "$type$str\n"; # uncoverable statement
906 }
907
908}
909
910sub highlight_yaml {
911 my ($self) = @_;
912 require YAML::PP::Highlight;
913 my $tokens = $self->tokens;
914 my $highlighted = YAML::PP::Highlight->ansicolored($tokens);
915 warn $highlighted;
916}
917
918sub exception {
919 my ($self, $msg, %args) = @_;
920 my $next = $self->lexer->next_tokens;
921 my $line = @$next ? $next->[0]->{line} : $self->lexer->line;
922 my $offset = @$next ? $next->[0]->{column} : $self->lexer->offset;
923 $offset++;
924 my $next_line = $self->lexer->next_line;
925 my $remaining = '';
926 if ($next_line) {
927 if ($self->lexer->offset > 0) {
928 $remaining = $next_line->[1] . $next_line->[2];
929 }
930 else {
931 $remaining = join '', @$next_line;
932 }
933 }
934 my $caller = $args{caller} || [ caller(0) ];
935 my $e = YAML::PP::Exception->new(
936 got => $args{got},
937 expected => $args{expected},
938 line => $line,
939 column => $offset,
940 msg => $msg,
941 next => $next,
942 where => $caller->[1] . ' line ' . $caller->[2],
943 yaml => $remaining,
944 );
945 croak $e;
946}
947
948sub expected {
949 my ($self, %args) = @_;
950 my $expected = $args{expected};
951 @$expected = sort grep { m/^[A-Z_]+$/ } @$expected;
952 my $got = $args{got}->{name};
953 my @caller = caller(0);
954 $self->exception("Expected (@$expected), but got $got",
955 caller => \@caller,
956 expected => $expected,
957 got => $args{got},
958 );
959}
960
961sub cb_tag {
962 my ($self, $token) = @_;
963 my $stack = $self->event_stack;
964 if (! @$stack or $stack->[-1]->[0] ne 'properties') {
965 push @$stack, [ properties => {} ];
966 }
967 my $last = $stack->[-1]->[1];
968 my $tag = $self->_read_tag($token->{value}, $self->tagmap);
969 $last->{inline} ||= [];
970 push @{ $last->{inline} }, {
971 type => 'tag',
972 value => $tag,
973 offset => $token->{column},
974 };
975}
976
977sub _read_tag {
978 my ($self, $tag, $map) = @_;
979 if ($tag eq '!') {
980 return "!";
981 }
982 elsif ($tag =~ m/^!<(.*)>/) {
983 return $1;
984 }
985 elsif ($tag =~ m/^(![^!]*!|!)(.+)/) {
986 my $alias = $1;
987 my $name = $2;
988 $name =~ s/%([0-9a-fA-F]{2})/chr hex $1/eg;
989 if (exists $map->{ $alias }) {
990 $tag = $map->{ $alias }. $name;
991 }
992 else {
993 if ($alias ne '!' and $alias ne '!!') {
994 die "Found undefined tag handle '$alias'";
995 }
996 $tag = "!$name";
997 }
998 }
999 else {
1000 die "Invalid tag";
1001 }
1002 return $tag;
1003}
1004
1005sub cb_anchor {
1006 my ($self, $token) = @_;
1007 my $anchor = $token->{value};
1008 $anchor = substr($anchor, 1);
1009 my $stack = $self->event_stack;
1010 if (! @$stack or $stack->[-1]->[0] ne 'properties') {
1011 push @$stack, [ properties => {} ];
1012 }
1013 my $last = $stack->[-1]->[1];
1014 $last->{inline} ||= [];
1015 push @{ $last->{inline} }, {
1016 type => 'anchor',
1017 value => $anchor,
1018 offset => $token->{column},
1019 };
1020}
1021
1022sub cb_property_eol {
1023 my ($self, $res) = @_;
1024 my $stack = $self->event_stack;
1025 my $last = $stack->[-1]->[1];
1026 my $inline = delete $last->{inline} or return;
1027 my $newline = $last->{newline} ||= [];
1028 push @$newline, @$inline;
1029}
1030
1031
# spent 46.3ms (42.0+4.31) within YAML::PP::Parser::cb_mapkey which was called 6675 times, avg 7µs/call: # 6675 times (42.0ms+4.31ms) by YAML::PP::Parser::parse_tokens at line 401, avg 7µs/call
sub cb_mapkey {
103266751.96ms my ($self, $token) = @_;
103366756.70ms66754.31ms my $stack = $self->event_stack;
# spent 4.31ms making 6675 calls to YAML::PP::Parser::event_stack, avg 646ns/call
1034 my $info = {
1035 style => YAML_PLAIN_SCALAR_STYLE,
1036 value => $token->{value},
1037 offset => $token->{column},
1038667512.6ms };
103966752.16ms if (@$stack and $stack->[-1]->[0] eq 'properties') {
1040 $self->fetch_inline_properties($stack, $info);
1041 }
1042667517.5ms push @{ $stack }, [ scalar => $info ];
1043}
1044
1045
# spent 503ms (49.2+453) within YAML::PP::Parser::cb_send_mapkey which was called 6690 times, avg 75µs/call: # 6675 times (49.1ms+453ms) by YAML::PP::Parser::parse_tokens at line 401, avg 75µs/call # 15 times (124µs+579µs) by YAML::PP::Parser::cb_take_quoted_key at line 1187, avg 47µs/call
sub cb_send_mapkey {
104666901.40ms my ($self, $res) = @_;
104766906.14ms66903.01ms my $last = pop @{ $self->event_stack };
# spent 3.01ms making 6690 calls to YAML::PP::Parser::event_stack, avg 450ns/call
104866906.49ms6690448ms $self->scalar_event($last->[1]);
# spent 448ms making 6690 calls to YAML::PP::Parser::scalar_event, avg 67µs/call
1049669020.7ms66902.75ms $self->set_new_node(1);
# spent 2.75ms making 6690 calls to YAML::PP::Parser::set_new_node, avg 411ns/call
1050}
1051
1052
# spent 496ms (66.9+429) within YAML::PP::Parser::cb_send_scalar which was called 7497 times, avg 66µs/call: # 6470 times (58.3ms+365ms) by YAML::PP::Parser::parse_tokens at line 401, avg 65µs/call # 689 times (5.81ms+43.3ms) by YAML::PP::Parser::cb_flow_comma at line 1241, avg 71µs/call # 337 times (2.83ms+20.8ms) by YAML::PP::Parser::cb_end_flowseq at line 1231, avg 70µs/call # once (25µs+162µs) by YAML::PP::Parser::cb_send_block_scalar at line 1421
sub cb_send_scalar {
105374972.16ms my ($self, $res) = @_;
105474977.89ms74973.34ms my $last = pop @{ $self->event_stack };
# spent 3.34ms making 7497 calls to YAML::PP::Parser::event_stack, avg 446ns/call
105574971.66ms return unless $last;
105674978.65ms7497422ms $self->scalar_event($last->[1]);
# spent 422ms making 7497 calls to YAML::PP::Parser::scalar_event, avg 56µs/call
105774977.30ms74973.90ms my $e = $self->events;
# spent 3.90ms making 7497 calls to YAML::PP::Parser::events, avg 520ns/call
1058749725.6ms if ($e->[-1] eq 'IMAP') {
1059 $self->end_flow_mapping;
1060 }
1061}
1062
1063sub cb_empty_mapkey {
1064 my ($self, $token) = @_;
1065 my $stack = $self->event_stack;
1066 my $info = {
1067 style => YAML_PLAIN_SCALAR_STYLE,
1068 value => '',
1069 offset => $token->{column},
1070 };
1071 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1072 $self->fetch_inline_properties($stack, $info);
1073 }
1074 $self->scalar_event($info);
1075 $self->set_new_node(1);
1076}
1077
1078sub cb_send_flow_alias {
1079 my ($self, $token) = @_;
1080 my $alias = substr($token->{value}, 1);
1081 $self->alias_event({ value => $alias });
1082}
1083
1084sub cb_send_alias {
1085 my ($self, $token) = @_;
1086 my $alias = substr($token->{value}, 1);
1087 $self->alias_event({ value => $alias });
1088}
1089
1090sub cb_send_alias_key {
1091 my ($self, $token) = @_;
1092 my $alias = substr($token->{value}, 1);
1093 $self->alias_event({ value => $alias });
1094 $self->set_new_node(1);
1095}
1096
1097sub cb_send_alias_from_stack {
1098 my ($self, $token) = @_;
1099 my $last = pop @{ $self->event_stack };
1100 $self->alias_event($last->[1]);
1101}
1102
1103sub cb_alias {
1104 my ($self, $token) = @_;
1105 my $alias = substr($token->{value}, 1);
1106 push @{ $self->event_stack }, [ alias => {
1107 value => $alias,
1108 offset => $token->{column},
1109 }];
1110}
1111
1112sub cb_question {
1113 my ($self, $res) = @_;
1114 $self->set_new_node(1);
1115}
1116
1117sub cb_flow_question {
1118 my ($self, $res) = @_;
1119 $self->set_new_node(2);
1120}
1121
1122sub cb_empty_complexvalue {
1123 my ($self, $res) = @_;
1124 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
1125}
1126
1127sub cb_questionstart {
1128 my ($self, $token) = @_;
1129 $self->start_mapping($token->{column});
1130}
1131
1132sub cb_complexcolon {
1133 my ($self, $res) = @_;
1134 $self->set_new_node(1);
1135}
1136
1137
# spent 17.0ms (1.92+15.0) within YAML::PP::Parser::cb_seqstart which was called 308 times, avg 55µs/call: # 308 times (1.92ms+15.0ms) by YAML::PP::Parser::parse_tokens at line 401, avg 55µs/call
sub cb_seqstart {
1138308128µs my ($self, $token) = @_;
1139308175µs my $column = $token->{column};
1140308555µs30814.8ms $self->start_sequence($column);
# spent 14.8ms making 308 calls to YAML::PP::Parser::start_sequence, avg 48µs/call
1141308744µs308215µs $self->set_new_node(1);
# spent 215µs making 308 calls to YAML::PP::Parser::set_new_node, avg 698ns/call
1142}
1143
1144
# spent 1.37ms (1.14+227µs) within YAML::PP::Parser::cb_seqitem which was called 302 times, avg 5µs/call: # 302 times (1.14ms+227µs) by YAML::PP::Parser::parse_tokens at line 401, avg 5µs/call
sub cb_seqitem {
1145302105µs my ($self, $res) = @_;
1146302932µs302227µs $self->set_new_node(1);
# spent 227µs making 302 calls to YAML::PP::Parser::set_new_node, avg 752ns/call
1147}
1148
1149
# spent 17.2ms (16.0+1.26) within YAML::PP::Parser::cb_take_quoted which was called 2056 times, avg 8µs/call: # 2041 times (15.9ms+1.24ms) by YAML::PP::Parser::parse_tokens at line 401, avg 8µs/call # 15 times (96µs+13µs) by YAML::PP::Parser::cb_take_quoted_key at line 1186, avg 7µs/call
sub cb_take_quoted {
11502056824µs my ($self, $token) = @_;
11512056843µs my $subtokens = $token->{subtokens};
115220562.13ms20561.26ms my $stack = $self->event_stack;
# spent 1.26ms making 2056 calls to YAML::PP::Parser::event_stack, avg 610ns/call
1153 my $info = {
1154 style => $subtokens->[0]->{value} eq '"'
1155 ? YAML_DOUBLE_QUOTED_SCALAR_STYLE
1156 : YAML_SINGLE_QUOTED_SCALAR_STYLE,
1157 value => $token->{value},
1158 offset => $token->{column},
115920565.00ms };
11602056874µs if (@$stack and $stack->[-1]->[0] eq 'properties') {
1161 $self->fetch_inline_properties($stack, $info);
1162 }
116320564.99ms push @{ $stack }, [ scalar => $info ];
1164}
1165
1166sub cb_quoted_multiline {
1167 my ($self, $token) = @_;
1168 my $subtokens = $token->{subtokens};
1169 my $stack = $self->event_stack;
1170 my $info = {
1171 style => $subtokens->[0]->{value} eq '"'
1172 ? YAML_DOUBLE_QUOTED_SCALAR_STYLE
1173 : YAML_SINGLE_QUOTED_SCALAR_STYLE,
1174 value => $token->{value},
1175 offset => $token->{column},
1176 };
1177 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1178 $self->fetch_inline_properties($stack, $info);
1179 }
1180 push @{ $stack }, [ scalar => $info ];
1181 $self->cb_send_scalar;
1182}
1183
1184
# spent 909µs (97+812) within YAML::PP::Parser::cb_take_quoted_key which was called 15 times, avg 61µs/call: # 15 times (97µs+812µs) by YAML::PP::Parser::parse_tokens at line 401, avg 61µs/call
sub cb_take_quoted_key {
1185157µs my ($self, $token) = @_;
11861520µs15109µs $self->cb_take_quoted($token);
# spent 109µs making 15 calls to YAML::PP::Parser::cb_take_quoted, avg 7µs/call
11871555µs15703µs $self->cb_send_mapkey;
# spent 703µs making 15 calls to YAML::PP::Parser::cb_send_mapkey, avg 47µs/call
1188}
1189
1190sub cb_send_plain_multi {
1191 my ($self, $token) = @_;
1192 my $stack = $self->event_stack;
1193 my $info = {
1194 style => YAML_PLAIN_SCALAR_STYLE,
1195 value => $token->{value},
1196 offset => $token->{column},
1197 };
1198 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1199 $self->fetch_inline_properties($stack, $info);
1200 }
1201 push @{ $stack }, [ scalar => $info ];
1202 $self->cb_send_scalar;
1203}
1204
1205
# spent 72.2ms (64.5+7.67) within YAML::PP::Parser::cb_start_plain which was called 12180 times, avg 6µs/call: # 12180 times (64.5ms+7.67ms) by YAML::PP::Parser::parse_tokens at line 401, avg 6µs/call
sub cb_start_plain {
1206121802.77ms my ($self, $token) = @_;
12071218011.3ms121807.67ms my $stack = $self->event_stack;
# spent 7.67ms making 12180 calls to YAML::PP::Parser::event_stack, avg 630ns/call
1208 my $info = {
1209 style => YAML_PLAIN_SCALAR_STYLE,
1210 value => $token->{value},
1211 offset => $token->{column},
12121218020.3ms };
1213121803.20ms if (@$stack and $stack->[-1]->[0] eq 'properties') {
1214 $self->fetch_inline_properties($stack, $info);
1215 }
12161218023.7ms push @{ $stack }, [ scalar => $info ];
1217}
1218
1219
# spent 19.3ms (1.29+18.1) within YAML::PP::Parser::cb_start_flowseq which was called 337 times, avg 57µs/call: # 337 times (1.29ms+18.1ms) by YAML::PP::Parser::parse_tokens at line 401, avg 57µs/call
sub cb_start_flowseq {
1220337127µs my ($self, $token) = @_;
12213371.19ms33718.1ms $self->start_flow_sequence($token->{column});
# spent 18.1ms making 337 calls to YAML::PP::Parser::start_flow_sequence, avg 54µs/call
1222}
1223
1224
# spent 13.9ms (1.05+12.9) within YAML::PP::Parser::cb_start_flowmap which was called 214 times, avg 65µs/call: # 214 times (1.05ms+12.9ms) by YAML::PP::Parser::parse_tokens at line 401, avg 65µs/call
sub cb_start_flowmap {
1225214109µs my ($self, $token) = @_;
1226214810µs21412.9ms $self->start_flow_mapping($token->{column});
# spent 12.9ms making 214 calls to YAML::PP::Parser::start_flow_mapping, avg 60µs/call
1227}
1228
1229
# spent 41.3ms (2.71+38.6) within YAML::PP::Parser::cb_end_flowseq which was called 337 times, avg 123µs/call: # 337 times (2.71ms+38.6ms) by YAML::PP::Parser::parse_tokens at line 401, avg 123µs/call
sub cb_end_flowseq {
1230337107µs my ($self, $res) = @_;
1231337420µs33723.6ms $self->cb_send_scalar;
# spent 23.6ms making 337 calls to YAML::PP::Parser::cb_send_scalar, avg 70µs/call
1232337646µs33714.8ms $self->end_flow_sequence;
# spent 14.8ms making 337 calls to YAML::PP::Parser::end_flow_sequence, avg 44µs/call
1233337892µs337207µs $self->set_new_node(0);
# spent 207µs making 337 calls to YAML::PP::Parser::set_new_node, avg 614ns/call
1234}
1235
1236
# spent 56.5ms (5.99+50.5) within YAML::PP::Parser::cb_flow_comma which was called 689 times, avg 82µs/call: # 689 times (5.99ms+50.5ms) by YAML::PP::Parser::parse_tokens at line 401, avg 82µs/call
sub cb_flow_comma {
1237689227µs my ($self) = @_;
1238689647µs689466µs my $event_types = $self->events;
# spent 466µs making 689 calls to YAML::PP::Parser::events, avg 676ns/call
1239689511µs689455µs $self->set_new_node(0);
# spent 455µs making 689 calls to YAML::PP::Parser::set_new_node, avg 660ns/call
12406892.72ms689481µs if ($event_types->[-1] =~ m/^FLOWSEQ/) {
# spent 481µs making 689 calls to YAML::PP::Parser::CORE:match, avg 698ns/call
1241689669µs68949.1ms $self->cb_send_scalar;
# spent 49.1ms making 689 calls to YAML::PP::Parser::cb_send_scalar, avg 71µs/call
1242689378µs $event_types->[-1] = $next_event{ $event_types->[-1] };
1243 }
1244}
1245
1246
# spent 129µs (112+17) within YAML::PP::Parser::cb_flow_colon which was called 29 times, avg 4µs/call: # 29 times (112µs+17µs) by YAML::PP::Parser::parse_tokens at line 401, avg 4µs/call
sub cb_flow_colon {
12472919µs my ($self) = @_;
12482964µs2917µs $self->set_new_node(1);
# spent 17µs making 29 calls to YAML::PP::Parser::set_new_node, avg 586ns/call
1249}
1250
1251sub cb_empty_flow_mapkey {
1252 my ($self, $token) = @_;
1253 my $stack = $self->event_stack;
1254 my $info = {
1255 style => YAML_PLAIN_SCALAR_STYLE,
1256 value => '',
1257 offset => $token->{column},
1258 };
1259 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1260 $self->fetch_inline_properties($stack, $info);
1261 }
1262 $self->scalar_event($info);
1263}
1264
1265
# spent 12.1ms (1.38+10.7) within YAML::PP::Parser::cb_end_flowmap which was called 214 times, avg 56µs/call: # 214 times (1.38ms+10.7ms) by YAML::PP::Parser::parse_tokens at line 401, avg 56µs/call
sub cb_end_flowmap {
126621493µs my ($self, $res) = @_;
1267214415µs21410.5ms $self->end_flow_mapping;
# spent 10.5ms making 214 calls to YAML::PP::Parser::end_flow_mapping, avg 49µs/call
1268214582µs214161µs $self->set_new_node(0);
# spent 161µs making 214 calls to YAML::PP::Parser::set_new_node, avg 752ns/call
1269}
1270
1271sub cb_end_flowmap_empty {
1272 my ($self, $res) = @_;
1273 $self->cb_empty_flowmap_value;
1274 $self->end_flow_mapping;
1275 $self->set_new_node(0);
1276}
1277
1278
# spent 3.39ms (493µs+2.89) within YAML::PP::Parser::cb_flowkey_plain which was called 29 times, avg 117µs/call: # 29 times (493µs+2.89ms) by YAML::PP::Parser::parse_tokens at line 401, avg 117µs/call
sub cb_flowkey_plain {
12792915µs my ($self, $token) = @_;
12802940µs2924µs my $stack = $self->event_stack;
# spent 24µs making 29 calls to YAML::PP::Parser::event_stack, avg 828ns/call
1281 my $info = {
1282 style => YAML_PLAIN_SCALAR_STYLE,
1283 value => $token->{value},
1284 offset => $token->{column},
12852991µs };
12862931µs if (@$stack and $stack->[-1]->[0] eq 'properties') {
1287 $self->fetch_inline_properties($stack, $info);
1288 }
128929190µs292.87ms $self->scalar_event($info);
# spent 2.87ms making 29 calls to YAML::PP::Parser::scalar_event, avg 99µs/call
1290}
1291
1292sub cb_flowkey_quoted {
1293 my ($self, $token) = @_;
1294 my $stack = $self->event_stack;
1295 my $subtokens = $token->{subtokens};
1296 my $info = {
1297 style => $subtokens->[0]->{value} eq '"'
1298 ? YAML_DOUBLE_QUOTED_SCALAR_STYLE
1299 : YAML_SINGLE_QUOTED_SCALAR_STYLE,
1300 value => $token->{value},
1301 offset => $token->{column},
1302 };
1303 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1304 $self->fetch_inline_properties($stack, $info);
1305 }
1306 $self->scalar_event($info);
1307}
1308
1309sub cb_empty_flowmap_key_value {
1310 my ($self, $token) = @_;
1311 $self->cb_empty_flow_mapkey($token);
1312 $self->cb_empty_flowmap_value;
1313 $self->cb_flow_comma;
1314}
1315
1316sub cb_end_empty_flowmap_key_value {
1317 my ($self, $token) = @_;
1318 $self->cb_empty_flow_mapkey($token);
1319 $self->cb_empty_flowmap_value;
1320 $self->cb_flow_comma;
1321 $self->cb_end_flowmap;
1322}
1323
1324sub cb_empty_flowmap_value {
1325 my ($self, $token) = @_;
1326 my $stack = $self->event_stack;
1327 my $info = {
1328 style => YAML_PLAIN_SCALAR_STYLE,
1329 value => '',
1330 offset => $token->{column},
1331 };
1332 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1333 $self->fetch_inline_properties($stack, $info);
1334 }
1335 $self->scalar_event($info);
1336}
1337
1338sub cb_empty_flowseq_comma {
1339 my ($self, $token) = @_;
1340 $self->cb_empty_flowmap_value($token);
1341 $self->cb_flow_comma;
1342}
1343
1344sub cb_empty_flowseq_end {
1345 my ($self, $token) = @_;
1346 $self->cb_empty_flowmap_value($token);
1347 $self->cb_end_flowseq;
1348}
1349
1350sub cb_insert_map_alias {
1351 my ($self, $res) = @_;
1352 my $stack = $self->event_stack;
1353 my $scalar = pop @$stack;
1354 my $info = $scalar->[1];
1355 $self->start_mapping($info->{offset});
1356 $self->alias_event($info);
1357 $self->set_new_node(1);
1358}
1359
1360
# spent 904ms (70.9+833) within YAML::PP::Parser::cb_insert_map which was called 6725 times, avg 134µs/call: # 6725 times (70.9ms+833ms) by YAML::PP::Parser::parse_tokens at line 401, avg 134µs/call
sub cb_insert_map {
136167251.91ms my ($self, $res) = @_;
136267255.30ms67253.12ms my $stack = $self->event_stack;
# spent 3.12ms making 6725 calls to YAML::PP::Parser::event_stack, avg 465ns/call
136367252.91ms my $scalar = pop @$stack;
136467251.93ms my $info = $scalar->[1];
1365672510.5ms6725300ms $self->start_mapping($info->{offset});
# spent 300ms making 6725 calls to YAML::PP::Parser::start_mapping, avg 45µs/call
136667257.30ms6725527ms $self->scalar_event($info);
# spent 527ms making 6725 calls to YAML::PP::Parser::scalar_event, avg 78µs/call
1367672524.4ms67252.85ms $self->set_new_node(1);
# spent 2.85ms making 6725 calls to YAML::PP::Parser::set_new_node, avg 423ns/call
1368}
1369
1370sub cb_insert_implicit_flowseq_map {
1371 my ($self, $res) = @_;
1372 my $stack = $self->event_stack;
1373 my $scalar = pop @$stack;
1374 my $info = $scalar->[1];
1375 $self->start_flow_mapping($info->{offset}, 1);
1376 $self->scalar_event($info);
1377 $self->set_new_node(1);
1378}
1379
1380sub cb_insert_empty_implicit_flowseq_map {
1381 my ($self, $res) = @_;
1382 my $stack = $self->event_stack;
1383 my $scalar = pop @$stack;
1384 my $info = $scalar->[1];
1385 $self->start_flow_mapping($info->{offset}, 1);
1386 $self->cb_empty_flowmap_value;
1387 $self->set_new_node(2);
1388}
1389
1390sub cb_insert_empty_map {
1391 my ($self, $token) = @_;
1392 my $stack = $self->event_stack;
1393 my $info = {
1394 style => YAML_PLAIN_SCALAR_STYLE,
1395 value => '',
1396 offset => $token->{column},
1397 };
1398 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1399 $self->fetch_inline_properties($stack, $info);
1400 }
1401 $self->start_mapping($info->{offset});
1402 $self->scalar_event($info);
1403 $self->set_new_node(1);
1404}
1405
1406
# spent 209µs (20+189) within YAML::PP::Parser::cb_send_block_scalar which was called: # once (20µs+189µs) by YAML::PP::Parser::parse_tokens at line 401
sub cb_send_block_scalar {
140710s my ($self, $token) = @_;
140810s my $type = $token->{subtokens}->[0]->{value};
140911µs12µs my $stack = $self->event_stack;
# spent 2µs making 1 call to YAML::PP::Parser::event_stack
1410 my $info = {
1411 style => $type eq '|'
1412 ? YAML_LITERAL_SCALAR_STYLE
1413 : YAML_FOLDED_SCALAR_STYLE,
1414 value => $token->{value},
1415 offset => $token->{column},
141613µs };
141710s if (@$stack and $stack->[-1]->[0] eq 'properties') {
1418 $self->fetch_inline_properties($stack, $info);
1419 }
142012µs10s push @{ $self->event_stack }, [ scalar => $info ];
# spent 0s making 1 call to YAML::PP::Parser::event_stack
142117µs1187µs $self->cb_send_scalar;
# spent 187µs making 1 call to YAML::PP::Parser::cb_send_scalar
1422}
1423
1424sub cb_end_document {
1425 my ($self, $token) = @_;
1426 $self->end_document(0);
1427}
1428
1429sub cb_end_document_empty {
1430 my ($self, $token) = @_;
1431 $self->end_document(0);
1432}
1433
1434sub cb_doc_start_implicit {
1435 my ($self, $token) = @_;
1436 $self->start_document(1);
1437}
1438
1439
# spent 56µs (5+51) within YAML::PP::Parser::cb_doc_start_explicit which was called: # once (5µs+51µs) by YAML::PP::Parser::parse_tokens at line 401
sub cb_doc_start_explicit {
144010s my ($self, $token) = @_;
144114µs151µs $self->start_document(0);
# spent 51µs making 1 call to YAML::PP::Parser::start_document
1442}
1443
1444sub cb_end_doc_start_document {
1445 my ($self, $token) = @_;
1446 $self->end_document(1);
1447 $self->start_document(0);
1448}
1449
1450sub cb_tag_directive {
1451 my ($self, $token) = @_;
1452 my ($name, $tag_alias, $tag_url) = split ' ', $token->{value};
1453 $self->tagmap->{ $tag_alias } = $tag_url;
1454}
1455
1456sub cb_reserved_directive {
1457}
1458
1459sub cb_set_yaml_version_directive {
1460 my ($self, $token) = @_;
1461 if ($self->yaml_version_directive) {
1462 croak "Found duplicate YAML directive";
1463 }
1464 my ($version) = $token->{value} =~ m/^%YAML[ \t]+(1\.[12])/;
1465 $self->set_yaml_version($version || '1.2');
1466 $self->set_yaml_version_directive(1);
1467}
1468
1469110µs1;
 
# spent 7.98ms within YAML::PP::Parser::CORE:match which was called 15241 times, avg 524ns/call: # 13449 times (5.83ms+0s) by YAML::PP::Parser::lex_next_tokens at line 185, avg 434ns/call # 689 times (481µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1240, avg 698ns/call # 337 times (800µs+0s) by YAML::PP::Parser::end_flow_sequence at line 585, avg 2µs/call # 337 times (211µs+0s) by YAML::PP::Parser::start_flow_sequence at line 539, avg 626ns/call # 214 times (504µs+0s) by YAML::PP::Parser::end_flow_mapping at line 600, avg 2µs/call # 214 times (153µs+0s) by YAML::PP::Parser::start_flow_mapping at line 563, avg 715ns/call # once (0s+0s) by YAML::PP::Parser::end_document at line 633
sub YAML::PP::Parser::CORE:match; # opcode
# spent 5µs within YAML::PP::Parser::__ANON__ which was called 4 times, avg 1µs/call: # once (2µs+0s) by YAML::PP::Parser::BEGIN@18 at line 18 # once (1µs+0s) by YAML::PP::Parser::BEGIN@17 at line 17 # once (1µs+0s) by YAML::PP::Parser::BEGIN@20 at line 20 # once (1µs+0s) by YAML::PP::Parser::BEGIN@21 at line 21
sub YAML::PP::Parser::__ANON__; # xsub