Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm |
Statements | Executed 131499 statements in 239ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
91595 | 1 | 1 | 85.7ms | 85.7ms | keywords | JSON::Schema::Modern::Vocabulary::FormatAssertion::
2230 | 1 | 1 | 69.7ms | 1.09s | _eval_keyword_format | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1390 | 1 | 1 | 16.0ms | 305ms | __ANON__[:124] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
2230 | 1 | 1 | 6.26ms | 6.26ms | _get_default_format_validation | JSON::Schema::Modern::Vocabulary::FormatAssertion::
151 | 1 | 1 | 2.73ms | 28.6ms | __ANON__[:121] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
73 | 11 | 1 | 2.42ms | 2.42ms | CORE:regcomp (opcode) | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1541 | 2 | 1 | 1.08ms | 1.08ms | CORE:match (opcode) | JSON::Schema::Modern::Vocabulary::FormatAssertion::
63 | 1 | 1 | 921µs | 3.14ms | __ANON__[:132] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
74 | 12 | 1 | 73µs | 73µs | CORE:qr (opcode) | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 33µs | 37µs | BEGIN@1.312 | Module::Runtime::
1 | 1 | 1 | 15µs | 52µs | BEGIN@13 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 14µs | 38µs | BEGIN@14 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 14µs | 14µs | BEGIN@9 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 13µs | 615µs | BEGIN@11 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 11µs | 25µs | BEGIN@15 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 10µs | 23µs | BEGIN@16 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 8µs | 183µs | BEGIN@10 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 7µs | 142µs | BEGIN@12 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 7µs | 280µs | BEGIN@19 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 7µs | 58µs | BEGIN@2.313 | Module::Runtime::
1 | 1 | 1 | 6µs | 50µs | BEGIN@17 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 6µs | 26µs | BEGIN@18 | JSON::Schema::Modern::Vocabulary::FormatAssertion::
1 | 1 | 1 | 1µs | 1µs | vocabulary | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:101] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:117] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:125] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:126] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:127] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:128] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:130] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:134] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:135] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:38] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:41] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:44] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:47] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:51] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:77] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:78] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:96] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:97] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | __ANON__[:98] | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | _traverse_keyword_format | JSON::Schema::Modern::Vocabulary::FormatAssertion::
0 | 0 | 0 | 0s | 0s | evaluation_order | JSON::Schema::Modern::Vocabulary::FormatAssertion::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 2 | 32µs | 2 | 41µs | # spent 37µs (33+4) within Module::Runtime::BEGIN@1.312 which was called:
# once (33µs+4µs) by Module::Runtime::require_module at line 1 # spent 37µs making 1 call to Module::Runtime::BEGIN@1.312
# spent 4µs making 1 call to strict::import |
2 | 2 | 38µs | 2 | 109µs | # spent 58µs (7+51) within Module::Runtime::BEGIN@2.313 which was called:
# once (7µs+51µs) by Module::Runtime::require_module at line 2 # spent 58µs making 1 call to Module::Runtime::BEGIN@2.313
# spent 51µs making 1 call to warnings::import |
3 | package JSON::Schema::Modern::Vocabulary::FormatAssertion; | ||||
4 | # vim: set ts=8 sts=2 sw=2 tw=100 et : | ||||
5 | # ABSTRACT: Implementation of the JSON Schema Format-Assertion vocabulary | ||||
6 | |||||
7 | 1 | 0s | our $VERSION = '0.552'; | ||
8 | |||||
9 | 2 | 33µs | 1 | 14µs | # spent 14µs within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@9 which was called:
# once (14µs+0s) by Module::Runtime::require_module at line 9 # spent 14µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@9 |
10 | 2 | 28µs | 2 | 358µs | # spent 183µs (8+175) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@10 which was called:
# once (8µs+175µs) by Module::Runtime::require_module at line 10 # spent 183µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@10
# spent 175µs making 1 call to Moo::import |
11 | 3 | 31µs | 3 | 1.22ms | # spent 615µs (13+602) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@11 which was called:
# once (13µs+602µs) by Module::Runtime::require_module at line 11 # spent 615µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@11
# spent 587µs making 1 call to strictures::import
# spent 15µs making 1 call to strictures::VERSION |
12 | 2 | 46µs | 2 | 277µs | # spent 142µs (7+135) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@12 which was called:
# once (7µs+135µs) by Module::Runtime::require_module at line 12 # spent 142µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@12
# spent 135µs making 1 call to experimental::import |
13 | 2 | 41µs | 2 | 55µs | # spent 52µs (15+37) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@13 which was called:
# once (15µs+37µs) by Module::Runtime::require_module at line 13 # spent 52µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@13
# spent 3µs making 1 call to if::import |
14 | 2 | 31µs | 2 | 39µs | # spent 38µs (14+24) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@14 which was called:
# once (14µs+24µs) by Module::Runtime::require_module at line 14 # spent 38µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@14
# spent 1µs making 1 call to if::unimport |
15 | 2 | 26µs | 2 | 26µs | # spent 25µs (11+14) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@15 which was called:
# once (11µs+14µs) by Module::Runtime::require_module at line 15 # spent 25µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@15
# spent 1µs making 1 call to if::unimport |
16 | 2 | 22µs | 2 | 25µs | # spent 23µs (10+13) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@16 which was called:
# once (10µs+13µs) by Module::Runtime::require_module at line 16 # spent 23µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@16
# spent 2µs making 1 call to if::unimport |
17 | 2 | 16µs | 2 | 94µs | # spent 50µs (6+44) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@17 which was called:
# once (6µs+44µs) by Module::Runtime::require_module at line 17 # spent 50µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@17
# spent 44µs making 1 call to Exporter::import |
18 | 2 | 14µs | 2 | 46µs | # spent 26µs (6+20) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@18 which was called:
# once (6µs+20µs) by Module::Runtime::require_module at line 18 # spent 26µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@18
# spent 20µs making 1 call to Feature::Compat::Try::import |
19 | 2 | 2.51ms | 2 | 553µs | # spent 280µs (7+273) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@19 which was called:
# once (7µs+273µs) by Module::Runtime::require_module at line 19 # spent 280µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@19
# spent 273µs making 1 call to namespace::clean::import |
20 | |||||
21 | 1 | 2µs | 1 | 539µs | with 'JSON::Schema::Modern::Vocabulary'; # spent 539µs making 1 call to Moo::with |
22 | |||||
23 | # spent 1µs within JSON::Schema::Modern::Vocabulary::FormatAssertion::vocabulary which was called:
# once (1µs+0s) by JSON::Schema::Modern::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern.pm:670] at line 666 of JSON/Schema/Modern.pm | ||||
24 | 1 | 2µs | 'https://json-schema.org/draft/2020-12/vocab/format-assertion' => 'draft2020-12'; | ||
25 | } | ||||
26 | |||||
27 | sub evaluation_order { 3 } | ||||
28 | |||||
29 | # spent 85.7ms within JSON::Schema::Modern::Vocabulary::FormatAssertion::keywords which was called 91595 times, avg 936ns/call:
# 91595 times (85.7ms+0s) by JSON::Schema::Modern::_eval_subschema at line 535 of JSON/Schema/Modern.pm, avg 936ns/call | ||||
30 | 91595 | 142ms | qw(format); | ||
31 | } | ||||
32 | |||||
33 | { | ||||
34 | # for now, all built-in formats are constrained to the 'string' type | ||||
35 | |||||
36 | my $is_datetime = sub { | ||||
37 | eval { Time::Moment->from_string(uc($_[0])) } ? 1 : 0, | ||||
38 | 1 | 2µs | }; | ||
39 | my $is_email = sub { | ||||
40 | Email::Address::XS->parse($_[0])->is_valid; | ||||
41 | 1 | 1µs | }; | ||
42 | my $is_hostname = sub { | ||||
43 | Data::Validate::Domain::is_domain($_[0]); | ||||
44 | 1 | 1µs | }; | ||
45 | my $idn_decode = sub { | ||||
46 | try { return Net::IDN::Encode::domain_to_ascii($_[0]) } catch ($e) { return $_[0]; } | ||||
47 | 1 | 1µs | }; | ||
48 | my $is_ipv4 = sub { | ||||
49 | my @o = split(/\./, $_[0], 5); | ||||
50 | @o == 4 && (grep /^(?:0|[1-9][0-9]{0,2})$/, @o) == 4 && (grep $_ < 256, @o) == 4; | ||||
51 | 1 | 1µs | }; | ||
52 | # https://tools.ietf.org/html/rfc3339#appendix-A with some additions for the 2000 version | ||||
53 | # as defined in https://en.wikipedia.org/wiki/ISO_8601#Durations | ||||
54 | 1 | 5µs | my $duration_re = do { | ||
55 | 1 | 8µs | 1 | 2µs | my $num = qr{[0-9]+(?:[.,][0-9]+)?}; # spent 2µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
56 | 1 | 37µs | 2 | 30µs | my $second = qr{${num}S}; # spent 29µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
57 | 1 | 18µs | 2 | 13µs | my $minute = qr{${num}M}; # spent 12µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
58 | 1 | 23µs | 2 | 18µs | my $hour = qr{${num}H}; # spent 17µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
59 | 1 | 46µs | 2 | 39µs | my $time = qr{T(?=[0-9])(?:$hour)?(?:$minute)?(?:$second)?}; # spent 38µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
60 | 1 | 17µs | 2 | 12µs | my $day = qr{${num}D}; # spent 11µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
61 | 1 | 17µs | 2 | 12µs | my $month = qr{${num}M}; # spent 11µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
62 | 1 | 20µs | 2 | 15µs | my $year = qr{${num}Y}; # spent 14µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
63 | 1 | 18µs | 2 | 14µs | my $week = qr{${num}W}; # spent 13µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
64 | 1 | 41µs | 2 | 35µs | my $date = qr{(?=[0-9])(?:$year)?(?:$month)?(?:$day)?}; # spent 34µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
65 | 1 | 92µs | 2 | 77µs | qr{^P(?:(?=.)(?:$date)?(?:$time)?|$week)$}; # spent 76µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp
# spent 1µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr |
66 | }; | ||||
67 | |||||
68 | my $formats = +{ | ||||
69 | 'date-time' => sub { | ||||
70 | $is_datetime->($_[0]) || ( | ||||
71 | $_[0] =~ m/^(?:\d{4}-\d\d-\d\dT\d\d:\d\d):(\d\d)(?:\.\d+)?(?:[Zz]|[+-]\d\d:\d\d)$/a | ||||
72 | && $1 eq '60' | ||||
73 | && do { | ||||
74 | require DateTime::Format::RFC3339; | ||||
75 | eval { DateTime::Format::RFC3339->parse_datetime($_[0]) }; | ||||
76 | }); | ||||
77 | }, | ||||
78 | date => sub { $_[0] =~ /^\d{4}-(?:\d\d)-(?:\d\d)$/a && $is_datetime->($_[0].'T00:00:00Z') }, | ||||
79 | time => sub { | ||||
80 | return if $_[0] !~ /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?([Zz]|([+-])(\d\d):(\d\d))$/a | ||||
81 | or $1 > 23 | ||||
82 | or $2 > 59 | ||||
83 | or $3 > 60 | ||||
84 | or (defined($6) and $6 > 23) | ||||
85 | or (defined($7) and $7 > 59); | ||||
86 | |||||
87 | return 1 if $3 <= 59; | ||||
88 | return $1 == 23 && $2 == 59 if uc($4) eq 'Z'; | ||||
89 | |||||
90 | my $sign = $5 eq '+' ? 1 : -1; | ||||
91 | my $hour_zulu = $1 - $6*$sign; | ||||
92 | my $min_zulu = $2 - $7*$sign; | ||||
93 | $hour_zulu -= 1 if $min_zulu < 0; | ||||
94 | |||||
95 | return $hour_zulu%24 == 23 && $min_zulu%60 == 59; | ||||
96 | }, | ||||
97 | duration => sub { $_[0] =~ $duration_re && $_[0] !~ m{[.,][0-9]+[A-Z].} }, | ||||
98 | email => sub { $is_email->($_[0]) && $_[0] !~ /[^[:ascii:]]/ }, | ||||
99 | 'idn-email' => $is_email, | ||||
100 | hostname => $is_hostname, | ||||
101 | 'idn-hostname' => sub { $is_hostname->($idn_decode->($_[0])) }, | ||||
102 | ipv4 => $is_ipv4, | ||||
103 | ipv6 => sub { | ||||
104 | ($_[0] =~ /^(?:[[:xdigit:]]{0,4}:){0,7}[[:xdigit:]]{0,4}$/ | ||||
105 | || $_[0] =~ /^(?:[[:xdigit:]]{0,4}:){1,6}((?:[0-9]{1,3}\.){3}[0-9]{1,3})$/ | ||||
106 | && $is_ipv4->($1)) | ||||
107 | && $_[0] !~ /:::/ | ||||
108 | && $_[0] !~ /^:[^:]/ | ||||
109 | && $_[0] !~ /[^:]:$/ | ||||
110 | && do { | ||||
111 | my $double_colons = ()= ($_[0] =~ /::/g); | ||||
112 | my $colon_components = grep length, split(/:+/, $_[0], -1); | ||||
113 | $double_colons < 2 && ($double_colons > 0 | ||||
114 | || ($colon_components == 8 && !defined $1) | ||||
115 | || ($colon_components == 7 && defined $1)) | ||||
116 | }; | ||||
117 | }, | ||||
118 | # spent 28.6ms (2.73+25.8) within JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:121] which was called 151 times, avg 189µs/call:
# 151 times (2.73ms+25.8ms) by JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format at line 181, avg 189µs/call | ||||
119 | 151 | 328µs | 151 | 11.2ms | my $uri = Mojo::URL->new($_[0]); # spent 11.2ms making 151 calls to Mojo::URL::new, avg 74µs/call |
120 | 151 | 2.05ms | 453 | 14.7ms | fc($uri->to_unsafe_string) eq fc($_[0]) && $uri->is_abs && $_[0] !~ /[^[:ascii:]]/; # spent 14.1ms making 151 calls to Mojo::URL::to_unsafe_string, avg 93µs/call
# spent 461µs making 151 calls to Mojo::URL::is_abs, avg 3µs/call
# spent 90µs making 151 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:match, avg 596ns/call |
121 | }, | ||||
122 | # spent 305ms (16.0+289) within JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:124] which was called 1390 times, avg 220µs/call:
# 1390 times (16.0ms+289ms) by JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format at line 181, avg 220µs/call | ||||
123 | 1390 | 28.5ms | 4170 | 289ms | fc(Mojo::URL->new($_[0])->to_unsafe_string) eq fc($_[0]) && $_[0] !~ /[^[:ascii:]]/; # spent 175ms making 1390 calls to Mojo::URL::new, avg 126µs/call
# spent 113ms making 1390 calls to Mojo::URL::to_unsafe_string, avg 81µs/call
# spent 995µs making 1390 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:match, avg 716ns/call |
124 | }, | ||||
125 | iri => sub { Mojo::URL->new($_[0])->is_abs }, | ||||
126 | uuid => sub { $_[0] =~ /^[[:xdigit:]]{8}-(?:[[:xdigit:]]{4}-){3}[[:xdigit:]]{12}$/ }, | ||||
127 | 'json-pointer' => sub { (!length($_[0]) || $_[0] =~ m{^/}) && $_[0] !~ m{~(?![01])} }, | ||||
128 | 'relative-json-pointer' => sub { $_[0] =~ m{^(?:0|[1-9][0-9]*)(?:#$|$|/)} && $_[0] !~ m{~(?![01])} }, | ||||
129 | # spent 3.14ms (921µs+2.22) within JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:132] which was called 63 times, avg 50µs/call:
# 63 times (921µs+2.22ms) by JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format at line 181, avg 50µs/call | ||||
130 | 63 | 345µs | local $SIG{__WARN__} = sub { die @_ }; | ||
131 | 189 | 2.84ms | 126 | 2.22ms | eval { qr/$_[0]/; 1 ? 1 : 0 }; # spent 2.16ms making 63 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp, avg 34µs/call
# spent 61µs making 63 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr, avg 968ns/call |
132 | }, | ||||
133 | |||||
134 | 'iri-reference' => sub { 1 }, | ||||
135 | 'uri-template' => sub { 1 }, | ||||
136 | 1 | 28µs | }; | ||
137 | |||||
138 | 6690 | 1.67ms | # spent 6.26ms within JSON::Schema::Modern::Vocabulary::FormatAssertion::_get_default_format_validation which was called 2230 times, avg 3µs/call:
# 2230 times (6.26ms+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format at line 173, avg 3µs/call | ||
139 | 2230 | 5.69ms | return $formats->{$format}; | ||
140 | } | ||||
141 | } | ||||
142 | |||||
143 | 1 | 1µs | sub _traverse_keyword_format ($self, $schema, $state) { | ||
144 | return if not assert_keyword_type($state, $schema, 'string'); | ||||
145 | return 1; | ||||
146 | } | ||||
147 | |||||
148 | 11150 | 3.24ms | # spent 1.09s (69.7ms+1.02) within JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format which was called 2230 times, avg 487µs/call:
# 2230 times (69.7ms+1.02s) by JSON::Schema::Modern::_eval_subschema at line 548 of JSON/Schema/Modern.pm, avg 487µs/call | ||
149 | abort($state, 'unimplemented format "%s"', $schema->{format}) | ||||
150 | 2230 | 2.67ms | if $schema->{format} eq 'iri-reference' or $schema->{format} eq 'uri-template'; | ||
151 | |||||
152 | 2230 | 1.57ms | try { | ||
153 | 2230 | 7.40ms | if ($schema->{format} eq 'date-time' or $schema->{format} eq 'date') { | ||
154 | require Time::Moment; | ||||
155 | } | ||||
156 | elsif ($schema->{format} eq 'email' or $schema->{format} eq 'idn-email') { | ||||
157 | require Email::Address::XS; Email::Address::XS->VERSION(1.04); | ||||
158 | } | ||||
159 | elsif ($schema->{format} eq 'hostname' or $schema->{format} eq 'idn-hostname') { | ||||
160 | require Data::Validate::Domain; | ||||
161 | } | ||||
162 | elsif ($schema->{format} eq 'idn-hostname') { | ||||
163 | require Net::IDN::Encode; | ||||
164 | } | ||||
165 | } | ||||
166 | catch ($e) { | ||||
167 | return E($state, 'cannot validate format "%s": %s', $schema->{format}, $e); | ||||
168 | } | ||||
169 | |||||
170 | # first check the subrefs from JSON::Schema::Modern->new(format_evaluations => { ... }) | ||||
171 | # and add in the type if needed | ||||
172 | 2230 | 7.74ms | 2230 | 68.8ms | my $evaluator_spec = $state->{evaluator}->_get_format_validation($schema->{format}); # spent 68.8ms making 2230 calls to JSON::Schema::Modern::_get_format_validation, avg 31µs/call |
173 | 2230 | 5.47ms | 2230 | 6.26ms | my $default_spec = $self->_get_default_format_validation($schema->{format}); # spent 6.26ms making 2230 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::_get_default_format_validation, avg 3µs/call |
174 | |||||
175 | 2230 | 3.66ms | my $spec = | ||
176 | $evaluator_spec ? ($default_spec ? +{ type => 'string', sub => $evaluator_spec } : $evaluator_spec) | ||||
177 | : $default_spec ? +{ type => 'string', sub => $default_spec } | ||||
178 | : undef; | ||||
179 | |||||
180 | return E($state, 'not a%s %s', $schema->{format} =~ /^[aeio]/ ? 'n' : '', $schema->{format}) | ||||
181 | 2230 | 8.63ms | 3208 | 353ms | if $spec and is_type($spec->{type}, $data) and not $spec->{sub}->($data); # spent 305ms making 1390 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:124], avg 220µs/call
# spent 28.6ms making 151 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:121], avg 189µs/call
# spent 15.8ms making 1604 calls to JSON::Schema::Modern::Utilities::is_type, avg 10µs/call
# spent 3.14ms making 63 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:132], avg 50µs/call |
182 | |||||
183 | 2230 | 11.6ms | 2230 | 589ms | return A($state, $schema->{format}); # spent 589ms making 2230 calls to JSON::Schema::Modern::Utilities::A, avg 264µs/call |
184 | } | ||||
185 | |||||
186 | 1 | 36µs | 1; | ||
187 | |||||
188 | 1 | 67µs | 1 | 391µs | __END__ # spent 391µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |
# spent 1.08ms within JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:match which was called 1541 times, avg 704ns/call:
# 1390 times (995µs+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:124] at line 123, avg 716ns/call
# 151 times (90µs+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:121] at line 120, avg 596ns/call | |||||
# spent 73µs within JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr which was called 74 times, avg 986ns/call:
# 63 times (61µs+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:132] at line 131, avg 968ns/call
# once (2µs+0s) by Module::Runtime::require_module at line 55
# once (1µs+0s) by Module::Runtime::require_module at line 62
# once (1µs+0s) by Module::Runtime::require_module at line 63
# once (1µs+0s) by Module::Runtime::require_module at line 59
# once (1µs+0s) by Module::Runtime::require_module at line 58
# once (1µs+0s) by Module::Runtime::require_module at line 64
# once (1µs+0s) by Module::Runtime::require_module at line 65
# once (1µs+0s) by Module::Runtime::require_module at line 56
# once (1µs+0s) by Module::Runtime::require_module at line 61
# once (1µs+0s) by Module::Runtime::require_module at line 57
# once (1µs+0s) by Module::Runtime::require_module at line 60 | |||||
# spent 2.42ms within JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp which was called 73 times, avg 33µs/call:
# 63 times (2.16ms+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:132] at line 131, avg 34µs/call
# once (76µs+0s) by Module::Runtime::require_module at line 65
# once (38µs+0s) by Module::Runtime::require_module at line 59
# once (34µs+0s) by Module::Runtime::require_module at line 64
# once (29µs+0s) by Module::Runtime::require_module at line 56
# once (17µs+0s) by Module::Runtime::require_module at line 58
# once (14µs+0s) by Module::Runtime::require_module at line 62
# once (13µs+0s) by Module::Runtime::require_module at line 63
# once (12µs+0s) by Module::Runtime::require_module at line 57
# once (11µs+0s) by Module::Runtime::require_module at line 61
# once (11µs+0s) by Module::Runtime::require_module at line 60 |