← 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:04 2022

Filename/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm
StatementsExecuted 41945 statements in 72.8ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
22201148.5ms440msJSON::Schema::Modern::Vocabulary::FormatAssertion::::_eval_keyword_formatJSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format
13801114.1ms276msJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:124]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:124]
2220115.51ms5.51msJSON::Schema::Modern::Vocabulary::FormatAssertion::::_get_default_format_validationJSON::Schema::Modern::Vocabulary::FormatAssertion::_get_default_format_validation
151112.94ms29.7msJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:121]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:121]
731112.15ms2.15msJSON::Schema::Modern::Vocabulary::FormatAssertion::::CORE:regcompJSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp (opcode)
153121962µs962µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::CORE:matchJSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:match (opcode)
6311921µs2.95msJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:132]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:132]
74121101µs101µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::CORE:qrJSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr (opcode)
11131µs35µsModule::Runtime::::BEGIN@1.313 Module::Runtime::BEGIN@1.313
11115µs604µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@11JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@11
11110µs33µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@13JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@13
11110µs10µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@9JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@9
1118µs20µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@14JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@14
1118µs16µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@16JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@16
1118µs45µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@17JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@17
1117µs19µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@15JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@15
1117µs39µsModule::Runtime::::BEGIN@2.314 Module::Runtime::BEGIN@2.314
1116µs203µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@10JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@10
1116µs88µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@12JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@12
1116µs20µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@18JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@18
1115µs161µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::BEGIN@19JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@19
1113µs3µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::keywordsJSON::Schema::Modern::Vocabulary::FormatAssertion::keywords
1112µs2µsJSON::Schema::Modern::Vocabulary::FormatAssertion::::vocabularyJSON::Schema::Modern::Vocabulary::FormatAssertion::vocabulary
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:101]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:101]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:117]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:117]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:125]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:125]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:126]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:126]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:127]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:127]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:128]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:128]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:130]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:130]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:134]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:134]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:135]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:135]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:38]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:38]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:41]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:41]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:44]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:44]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:47]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:47]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:51]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:51]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:77]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:77]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:78]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:78]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:96]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:96]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:97]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:97]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::__ANON__[:98]JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[:98]
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::_traverse_keyword_formatJSON::Schema::Modern::Vocabulary::FormatAssertion::_traverse_keyword_format
0000s0sJSON::Schema::Modern::Vocabulary::FormatAssertion::::evaluation_orderJSON::Schema::Modern::Vocabulary::FormatAssertion::evaluation_order
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1231µs239µs
# spent 35µs (31+4) within Module::Runtime::BEGIN@1.313 which was called: # once (31µs+4µs) by Module::Runtime::require_module at line 1
use strict;
# spent 35µs making 1 call to Module::Runtime::BEGIN@1.313 # spent 4µs making 1 call to strict::import
2241µs271µs
# spent 39µs (7+32) within Module::Runtime::BEGIN@2.314 which was called: # once (7µs+32µs) by Module::Runtime::require_module at line 2
use warnings;
# spent 39µs making 1 call to Module::Runtime::BEGIN@2.314 # spent 32µs making 1 call to warnings::import
3package 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
710sour $VERSION = '0.559';
8
9229µs110µs
# spent 10µs within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@9 which was called: # once (10µs+0s) by Module::Runtime::require_module at line 9
use 5.020;
10222µs2400µs
# spent 203µs (6+197) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@10 which was called: # once (6µs+197µs) by Module::Runtime::require_module at line 10
use Moo;
# spent 203µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@10 # spent 197µs making 1 call to Moo::import
11333µs31.19ms
# spent 604µs (15+589) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@11 which was called: # once (15µs+589µs) by Module::Runtime::require_module at line 11
use strictures 2;
# spent 604µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@11 # spent 574µs making 1 call to strictures::import # spent 15µs making 1 call to strictures::VERSION
12228µs2170µs
# spent 88µs (6+82) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@12 which was called: # once (6µs+82µs) by Module::Runtime::require_module at line 12
use experimental qw(signatures postderef);
# spent 88µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@12 # spent 82µs making 1 call to experimental::import
13224µs236µs
# spent 33µs (10+23) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@13 which was called: # once (10µs+23µs) by Module::Runtime::require_module at line 13
use if "$]" >= 5.022, experimental => 're_strict';
# spent 33µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@13 # spent 3µs making 1 call to if::import
14219µs220µs
# spent 20µs (8+12) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@14 which was called: # once (8µs+12µs) by Module::Runtime::require_module at line 14
no if "$]" >= 5.031009, feature => 'indirect';
# spent 20µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@14 # spent 0s making 1 call to if::unimport
15218µs221µs
# spent 19µs (7+12) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@15 which was called: # once (7µs+12µs) by Module::Runtime::require_module at line 15
no if "$]" >= 5.033001, feature => 'multidimensional';
# spent 19µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@15 # spent 2µs making 1 call to if::unimport
16216µs217µs
# spent 16µs (8+8) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@16 which was called: # once (8µs+8µs) by Module::Runtime::require_module at line 16
no if "$]" >= 5.033006, feature => 'bareword_filehandles';
# spent 16µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@16 # spent 1µs making 1 call to if::unimport
17216µs282µs
# spent 45µs (8+37) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@17 which was called: # once (8µs+37µs) by Module::Runtime::require_module at line 17
use JSON::Schema::Modern::Utilities qw(is_type E A assert_keyword_type abort);
# spent 45µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@17 # spent 37µs making 1 call to Exporter::import
18215µs234µs
# spent 20µs (6+14) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@18 which was called: # once (6µs+14µs) by Module::Runtime::require_module at line 18
use Feature::Compat::Try;
# spent 20µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@18 # spent 14µs making 1 call to Feature::Compat::Try::import
1921.89ms2317µs
# spent 161µs (5+156) within JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@19 which was called: # once (5µs+156µs) by Module::Runtime::require_module at line 19
use namespace::clean;
# spent 161µs making 1 call to JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@19 # spent 156µs making 1 call to namespace::clean::import
20
2113µs1437µswith 'JSON::Schema::Modern::Vocabulary';
# spent 437µs making 1 call to Moo::with
22
23
# spent 2µs within JSON::Schema::Modern::Vocabulary::FormatAssertion::vocabulary which was called: # once (2µs+0s) by JSON::Schema::Modern::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm:709] at line 705 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm
sub vocabulary {
2413µs 'https://json-schema.org/draft/2020-12/vocab/format-assertion' => 'draft2020-12';
25}
26
27sub evaluation_order { 3 }
28
29
# spent 3µs within JSON::Schema::Modern::Vocabulary::FormatAssertion::keywords which was called: # once (3µs+0s) by JSON::Schema::Modern::_eval_subschema at line 572 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm
sub keywords {
3013µs 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,
3812µs };
39 my $is_email = sub {
40 Email::Address::XS->parse($_[0])->is_valid;
4111µs };
42 my $is_hostname = sub {
43 Data::Validate::Domain::is_domain($_[0]);
4411µs };
45 my $idn_decode = sub {
46 try { return Net::IDN::Encode::domain_to_ascii($_[0]) } catch ($e) { return $_[0]; }
4718µ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;
5111µ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
5413µs my $duration_re = do {
5518µs13µs my $num = qr{[0-9]+(?:[.,][0-9]+)?};
56147µs225µs my $second = qr{${num}S};
57138µs231µs my $minute = qr{${num}M};
58114µs212µs my $hour = qr{${num}H};
59128µs223µs my $time = qr{T(?=[0-9])(?:$hour)?(?:$minute)?(?:$second)?};
60111µs28µs my $day = qr{${num}D};
61118µs216µs my $month = qr{${num}M};
62110µs27µs my $year = qr{${num}Y};
63110µs25µs my $week = qr{${num}W};
64132µs226µs my $date = qr{(?=[0-9])(?:$year)?(?:$month)?(?:$day)?};
65189µs271µs qr{^P(?:(?=.)(?:$date)?(?:$time)?|$week)$};
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 29.7ms (2.94+26.8) within JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:121] which was called 151 times, avg 197µs/call: # 151 times (2.94ms+26.8ms) by JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format at line 182, avg 197µs/call
uri => sub {
119151280µs15111.3ms my $uri = Mojo::URL->new($_[0]);
# spent 11.3ms making 151 calls to Mojo::URL::new, avg 75µs/call
1201512.43ms45315.5ms fc($uri->to_unsafe_string) eq fc($_[0]) && $uri->is_abs && $_[0] !~ /[^[:ascii:]]/;
# spent 14.9ms making 151 calls to Mojo::URL::to_unsafe_string, avg 99µs/call # spent 483µs making 151 calls to Mojo::URL::is_abs, avg 3µs/call # spent 79µs making 151 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:match, avg 523ns/call
121 },
122
# spent 276ms (14.1+262) within JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:124] which was called 1380 times, avg 200µs/call: # 1380 times (14.1ms+262ms) by JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format at line 182, avg 200µs/call
'uri-reference' => sub {
123138012.6ms4140262ms fc(Mojo::URL->new($_[0])->to_unsafe_string) eq fc($_[0]) && $_[0] !~ /[^[:ascii:]]/;
# spent 160ms making 1380 calls to Mojo::URL::new, avg 116µs/call # spent 101ms making 1380 calls to Mojo::URL::to_unsafe_string, avg 73µs/call # spent 883µs making 1380 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:match, avg 640ns/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 2.95ms (921µs+2.03) within JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:132] which was called 63 times, avg 47µs/call: # 63 times (921µs+2.03ms) by JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format at line 182, avg 47µs/call
regex => sub {
13063288µs local $SIG{__WARN__} = sub { die @_ };
1311892.65ms1262.03ms eval { qr/$_[0]/; 1 ? 1 : 0 };
# spent 1.94ms making 63 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp, avg 31µs/call # spent 90µs making 63 calls to JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr, avg 1µs/call
132 },
133
134 'iri-reference' => sub { 1 },
135 'uri-template' => sub { 1 },
136130µs };
137
13866601.79ms
# spent 5.51ms within JSON::Schema::Modern::Vocabulary::FormatAssertion::_get_default_format_validation which was called 2220 times, avg 2µs/call: # 2220 times (5.51ms+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format at line 173, avg 2µs/call
sub _get_default_format_validation ($self, $format) {
13922205.23ms return $formats->{$format};
140 }
141}
142
14311µssub _traverse_keyword_format ($self, $schema, $state) {
144 return if not assert_keyword_type($state, $schema, 'string');
145 return 1;
146}
147
148111002.63ms
# spent 440ms (48.5+391) within JSON::Schema::Modern::Vocabulary::FormatAssertion::_eval_keyword_format which was called 2220 times, avg 198µs/call: # 2220 times (48.5ms+391ms) by JSON::Schema::Modern::_eval_subschema at line 587 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm, avg 198µs/call
sub _eval_keyword_format ($self, $data, $schema, $state) {
149 abort($state, 'unimplemented format "%s"', $schema->{format})
15022201.46ms if $schema->{format} eq 'uri-template';
151
15222201.55ms try {
15322206.17ms 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
17222206.59ms222059.6ms my $evaluator_spec = $state->{evaluator}->_get_format_validation($schema->{format});
# spent 59.6ms making 2220 calls to JSON::Schema::Modern::_get_format_validation, avg 27µs/call
17322205.35ms22205.51ms my $default_spec = $self->_get_default_format_validation($schema->{format});
174
17522202.89ms 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
18022203.59ms22205.28ms A($state, $schema->{format});
# spent 5.28ms making 2220 calls to JSON::Schema::Modern::Utilities::A, avg 2µs/call
181 return E($state, 'not a%s %s', $schema->{format} =~ /^[aeio]/ ? 'n' : '', $schema->{format})
18222208.10ms3188321ms if $spec and is_type($spec->{type}, $data) and not $spec->{sub}->($data);
183
18422206.50ms return 1;
185}
186
187145µs1;
188152µs1319µs__END__
 
# spent 962µs within JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:match which was called 1531 times, avg 628ns/call: # 1380 times (883µs+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:124] at line 123, avg 640ns/call # 151 times (79µs+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:121] at line 120, avg 523ns/call
sub JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:match; # opcode
# spent 101µs within JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr which was called 74 times, avg 1µs/call: # 63 times (90µs+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:132] at line 131, avg 1µs/call # once (3µs+0s) by Module::Runtime::require_module at line 55 # once (2µs+0s) by Module::Runtime::require_module at line 57 # once (1µs+0s) by Module::Runtime::require_module at line 58 # once (1µs+0s) by Module::Runtime::require_module at line 62 # once (1µs+0s) by Module::Runtime::require_module at line 61 # once (1µs+0s) by Module::Runtime::require_module at line 65 # once (1µs+0s) by Module::Runtime::require_module at line 64 # once (1µs+0s) by Module::Runtime::require_module at line 56 # once (0s+0s) by Module::Runtime::require_module at line 60 # once (0s+0s) by Module::Runtime::require_module at line 59 # once (0s+0s) by Module::Runtime::require_module at line 63
sub JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:qr; # opcode
# spent 2.15ms within JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp which was called 73 times, avg 30µs/call: # 63 times (1.94ms+0s) by JSON::Schema::Modern::Vocabulary::FormatAssertion::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm:132] at line 131, avg 31µs/call # once (70µs+0s) by Module::Runtime::require_module at line 65 # once (29µs+0s) by Module::Runtime::require_module at line 57 # once (25µs+0s) by Module::Runtime::require_module at line 64 # once (24µs+0s) by Module::Runtime::require_module at line 56 # once (23µs+0s) by Module::Runtime::require_module at line 59 # once (15µs+0s) by Module::Runtime::require_module at line 61 # once (11µs+0s) by Module::Runtime::require_module at line 58 # once (8µs+0s) by Module::Runtime::require_module at line 60 # once (6µs+0s) by Module::Runtime::require_module at line 62 # once (5µs+0s) by Module::Runtime::require_module at line 63
sub JSON::Schema::Modern::Vocabulary::FormatAssertion::CORE:regcomp; # opcode