← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Thu Dec 15 15:23:56 2022
Reported on Thu Dec 15 15:27:03 2022

Filename/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Error.pm
StatementsExecuted 4236 statements in 20.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
41961120.3ms74.9msJSON::Schema::Modern::Error::::__ANON__[:39]JSON::Schema::Modern::Error::__ANON__[:39]
1117.74ms10.4msJSON::Schema::Modern::Error::::BEGIN@18JSON::Schema::Modern::Error::BEGIN@18
1112.04ms23.2msJSON::Schema::Modern::Error::::BEGIN@21JSON::Schema::Modern::Error::BEGIN@21
11125µs28µsJSON::Schema::Modern::::BEGIN@1.66 JSON::Schema::Modern::BEGIN@1.66
11112µs643µsJSON::Schema::Modern::Error::::BEGIN@11JSON::Schema::Modern::Error::BEGIN@11
11112µs34µsJSON::Schema::Modern::Error::::BEGIN@13JSON::Schema::Modern::Error::BEGIN@13
11110µs25µsJSON::Schema::Modern::Error::::BEGIN@14JSON::Schema::Modern::Error::BEGIN@14
11110µs552µsJSON::Schema::Modern::Error::::BEGIN@19JSON::Schema::Modern::Error::BEGIN@19
11110µs29µsJSON::Schema::Modern::Error::::BEGIN@24JSON::Schema::Modern::Error::BEGIN@24
1118µs88µsJSON::Schema::Modern::Error::::BEGIN@12JSON::Schema::Modern::Error::BEGIN@12
1118µs18µsJSON::Schema::Modern::Error::::BEGIN@15JSON::Schema::Modern::Error::BEGIN@15
1117µs16µsJSON::Schema::Modern::Error::::BEGIN@16JSON::Schema::Modern::Error::BEGIN@16
1117µs702µsJSON::Schema::Modern::Error::::BEGIN@20JSON::Schema::Modern::Error::BEGIN@20
1117µs7µsJSON::Schema::Modern::Error::::BEGIN@9JSON::Schema::Modern::Error::BEGIN@9
1116µs202µsJSON::Schema::Modern::Error::::BEGIN@10JSON::Schema::Modern::Error::BEGIN@10
1116µs76µsJSON::Schema::Modern::Error::::BEGIN@17JSON::Schema::Modern::Error::BEGIN@17
1115µs31µsJSON::Schema::Modern::::BEGIN@2.67 JSON::Schema::Modern::BEGIN@2.67
0000s0sJSON::Schema::Modern::Error::::TO_JSONJSON::Schema::Modern::Error::TO_JSON
0000s0sJSON::Schema::Modern::Error::::__ANON__[:24]JSON::Schema::Modern::Error::__ANON__[:24]
0000s0sJSON::Schema::Modern::Error::::__ANON__[:51]JSON::Schema::Modern::Error::__ANON__[:51]
0000s0sJSON::Schema::Modern::Error::::dumpJSON::Schema::Modern::Error::dump
0000s0sJSON::Schema::Modern::Error::::stringifyJSON::Schema::Modern::Error::stringify
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1226µs231µs
# spent 28µs (25+3) within JSON::Schema::Modern::BEGIN@1.66 which was called: # once (25µs+3µs) by JSON::Schema::Modern::BEGIN@33 at line 1
use strict;
# spent 28µs making 1 call to JSON::Schema::Modern::BEGIN@1.66 # spent 3µs making 1 call to strict::import
2235µs257µs
# spent 31µs (5+26) within JSON::Schema::Modern::BEGIN@2.67 which was called: # once (5µs+26µs) by JSON::Schema::Modern::BEGIN@33 at line 2
use warnings;
# spent 31µs making 1 call to JSON::Schema::Modern::BEGIN@2.67 # spent 26µs making 1 call to warnings::import
3package JSON::Schema::Modern::Error;
4# vim: set ts=8 sts=2 sw=2 tw=100 et :
5# ABSTRACT: Contains a single error from a JSON Schema evaluation
6
710sour $VERSION = '0.559';
8
9227µs17µs
# spent 7µs within JSON::Schema::Modern::Error::BEGIN@9 which was called: # once (7µs+0s) by JSON::Schema::Modern::BEGIN@33 at line 9
use 5.020;
# spent 7µs making 1 call to JSON::Schema::Modern::Error::BEGIN@9
10222µs2398µs
# spent 202µs (6+196) within JSON::Schema::Modern::Error::BEGIN@10 which was called: # once (6µs+196µs) by JSON::Schema::Modern::BEGIN@33 at line 10
use Moo;
# spent 202µs making 1 call to JSON::Schema::Modern::Error::BEGIN@10 # spent 196µs making 1 call to Moo::import
11345µs31.27ms
# spent 643µs (12+631) within JSON::Schema::Modern::Error::BEGIN@11 which was called: # once (12µs+631µs) by JSON::Schema::Modern::BEGIN@33 at line 11
use strictures 2;
# spent 643µs making 1 call to JSON::Schema::Modern::Error::BEGIN@11 # spent 616µs making 1 call to strictures::import # spent 15µs making 1 call to strictures::VERSION
12238µs2168µs
# spent 88µs (8+80) within JSON::Schema::Modern::Error::BEGIN@12 which was called: # once (8µs+80µs) by JSON::Schema::Modern::BEGIN@33 at line 12
use experimental qw(signatures postderef);
# spent 88µs making 1 call to JSON::Schema::Modern::Error::BEGIN@12 # spent 80µs making 1 call to experimental::import
13224µs237µs
# spent 34µs (12+22) within JSON::Schema::Modern::Error::BEGIN@13 which was called: # once (12µs+22µs) by JSON::Schema::Modern::BEGIN@33 at line 13
use if "$]" >= 5.022, experimental => 're_strict';
# spent 34µs making 1 call to JSON::Schema::Modern::Error::BEGIN@13 # spent 3µs making 1 call to if::import
14219µs227µs
# spent 25µs (10+15) within JSON::Schema::Modern::Error::BEGIN@14 which was called: # once (10µs+15µs) by JSON::Schema::Modern::BEGIN@33 at line 14
no if "$]" >= 5.031009, feature => 'indirect';
# spent 25µs making 1 call to JSON::Schema::Modern::Error::BEGIN@14 # spent 2µs making 1 call to if::unimport
15217µs219µs
# spent 18µs (8+10) within JSON::Schema::Modern::Error::BEGIN@15 which was called: # once (8µs+10µs) by JSON::Schema::Modern::BEGIN@33 at line 15
no if "$]" >= 5.033001, feature => 'multidimensional';
# spent 18µs making 1 call to JSON::Schema::Modern::Error::BEGIN@15 # spent 1µs making 1 call to if::unimport
16215µs217µs
# spent 16µs (7+9) within JSON::Schema::Modern::Error::BEGIN@16 which was called: # once (7µs+9µs) by JSON::Schema::Modern::BEGIN@33 at line 16
no if "$]" >= 5.033006, feature => 'bareword_filehandles';
# spent 16µs making 1 call to JSON::Schema::Modern::Error::BEGIN@16 # spent 1µs making 1 call to if::unimport
17216µs2146µs
# spent 76µs (6+70) within JSON::Schema::Modern::Error::BEGIN@17 which was called: # once (6µs+70µs) by JSON::Schema::Modern::BEGIN@33 at line 17
use Safe::Isa;
# spent 76µs making 1 call to JSON::Schema::Modern::Error::BEGIN@17 # spent 70µs making 1 call to Exporter::import
1821.02ms110.4ms
# spent 10.4ms (7.74+2.62) within JSON::Schema::Modern::Error::BEGIN@18 which was called: # once (7.74ms+2.62ms) by JSON::Schema::Modern::BEGIN@33 at line 18
use JSON::PP ();
# spent 10.4ms making 1 call to JSON::Schema::Modern::Error::BEGIN@18
19229µs21.09ms
# spent 552µs (10+542) within JSON::Schema::Modern::Error::BEGIN@19 which was called: # once (10µs+542µs) by JSON::Schema::Modern::BEGIN@33 at line 19
use MooX::TypeTiny;
# spent 552µs making 1 call to JSON::Schema::Modern::Error::BEGIN@19 # spent 542µs making 1 call to MooX::TypeTiny::import
20243µs21.40ms
# spent 702µs (7+695) within JSON::Schema::Modern::Error::BEGIN@20 which was called: # once (7µs+695µs) by JSON::Schema::Modern::BEGIN@33 at line 20
use Types::Standard qw(Str Undef InstanceOf Enum);
# spent 702µs making 1 call to JSON::Schema::Modern::Error::BEGIN@20 # spent 695µs making 1 call to Exporter::Tiny::import
2121.38ms223.4ms
# spent 23.2ms (2.04+21.1) within JSON::Schema::Modern::Error::BEGIN@21 which was called: # once (2.04ms+21.1ms) by JSON::Schema::Modern::BEGIN@33 at line 21
use namespace::clean;
# spent 23.2ms making 1 call to JSON::Schema::Modern::Error::BEGIN@21 # spent 239µs making 1 call to namespace::clean::import
22
23use overload
242245µs248µs
# spent 29µs (10+19) within JSON::Schema::Modern::Error::BEGIN@24 which was called: # once (10µs+19µs) by JSON::Schema::Modern::BEGIN@33 at line 24
'""' => sub { $_[0]->stringify };
# spent 29µs making 1 call to JSON::Schema::Modern::Error::BEGIN@24 # spent 19µs making 1 call to overload::import
25
2615µs219.4mshas [qw(
# spent 19.4ms making 1 call to JSON::Schema::Modern::Error::has # spent 2µs making 1 call to Types::Standard::Str
27 instance_location
28 keyword_location
29 error
30)] => (
31 is => 'ro',
32 isa => Str,
33 required => 1,
34);
35
36has absolute_keyword_location => (
37 is => 'ro',
38 isa => InstanceOf['Mojo::URL'],
39419617.1ms419654.6ms
# spent 74.9ms (20.3+54.6) within JSON::Schema::Modern::Error::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Error.pm:39] which was called 4196 times, avg 18µs/call: # 4196 times (20.3ms+54.6ms) by JSON::Schema::Modern::Error::new at line 68 of (eval 435)[Sub/Quote.pm:3], avg 18µs/call
coerce => sub { $_[0]->$_isa('Mojo::URL') ? $_[0] : Mojo::URL->new($_[0]) },
# spent 54.6ms making 4196 calls to Safe::Isa::__ANON__[Safe/Isa.pm:23], avg 13µs/call
4018µs24.08ms);
# spent 3.53ms making 1 call to Types::Standard::InstanceOf # spent 548µs making 1 call to JSON::Schema::Modern::Error::has
41
4219µs42.62mshas keyword => (
# spent 2.04ms making 1 call to Type::Tiny::__ANON__[Type/Tiny.pm:126] # spent 579µs making 1 call to JSON::Schema::Modern::Error::has # spent 3µs making 1 call to Types::Standard::Undef # spent 1µs making 1 call to Types::Standard::Str
43 is => 'ro',
44 isa => Str|Undef,
45 required => 1,
46);
47
48has exception => (
49 is => 'ro',
50 isa => InstanceOf['JSON::PP::Boolean'],
51 coerce => sub { $_[0] ? JSON::PP::true : JSON::PP::false },
5215µs2713µs);
# spent 426µs making 1 call to JSON::Schema::Modern::Error::has # spent 287µs making 1 call to Types::Standard::InstanceOf
53
5416µs23.97mshas mode => (
# spent 3.11ms making 1 call to Types::Standard::Enum # spent 856µs making 1 call to JSON::Schema::Modern::Error::has
55 is => 'rw',
56 isa => Enum[qw(traverse evaluate)],
57);
58
59sub TO_JSON ($self) {
60 return +{
61 # note that locations are JSON pointers, not uri fragments!
62 instanceLocation => $self->instance_location,
63 keywordLocation => $self->keyword_location,
64 !defined($self->absolute_keyword_location) ? ()
65 : ( absoluteKeywordLocation => $self->absolute_keyword_location->to_string ),
66 error => $self->error, # TODO: allow localization
67 };
68}
69
70sub stringify ($self) {
71 ($self->mode//'evaluate') eq 'traverse'
72 ? '\''.$self->keyword_location.'\': '.$self->error
73 : '\''.$self->instance_location.'\': '.$self->error;
74}
75
76sub dump ($self) {
77 my $encoder = JSON::MaybeXS->new(utf8 => 0, convert_blessed => 1, canonical => 1, pretty => 1);
78 $encoder->indent_length(2) if $encoder->can('indent_length');
79 $encoder->encode($self);
80}
81
82117µs1;
83129µs1269µs__END__