← 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/Annotation.pm
StatementsExecuted 36 statements in 658µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11150µs52µsJSON::Schema::Modern::Result::::BEGIN@1 JSON::Schema::Modern::Result::BEGIN@1
11115µs830µsJSON::Schema::Modern::Annotation::::BEGIN@11JSON::Schema::Modern::Annotation::BEGIN@11
11114µs29µsJSON::Schema::Modern::Annotation::::BEGIN@14JSON::Schema::Modern::Annotation::BEGIN@14
11111µs34µsJSON::Schema::Modern::Annotation::::BEGIN@13JSON::Schema::Modern::Annotation::BEGIN@13
1118µs17µsJSON::Schema::Modern::Annotation::::BEGIN@16JSON::Schema::Modern::Annotation::BEGIN@16
1117µs174µsJSON::Schema::Modern::Annotation::::BEGIN@20JSON::Schema::Modern::Annotation::BEGIN@20
1117µs7µsJSON::Schema::Modern::Annotation::::BEGIN@9JSON::Schema::Modern::Annotation::BEGIN@9
1116µs82µsJSON::Schema::Modern::Annotation::::BEGIN@12JSON::Schema::Modern::Annotation::BEGIN@12
1115µs169µsJSON::Schema::Modern::Annotation::::BEGIN@10JSON::Schema::Modern::Annotation::BEGIN@10
1115µs17µsJSON::Schema::Modern::Annotation::::BEGIN@15JSON::Schema::Modern::Annotation::BEGIN@15
1115µs102µsJSON::Schema::Modern::Annotation::::BEGIN@17JSON::Schema::Modern::Annotation::BEGIN@17
1115µs23µsJSON::Schema::Modern::Result::::BEGIN@2 JSON::Schema::Modern::Result::BEGIN@2
1114µs404µsJSON::Schema::Modern::Annotation::::BEGIN@18JSON::Schema::Modern::Annotation::BEGIN@18
1114µs328µsJSON::Schema::Modern::Annotation::::BEGIN@19JSON::Schema::Modern::Annotation::BEGIN@19
0000s0sJSON::Schema::Modern::Annotation::::TO_JSONJSON::Schema::Modern::Annotation::TO_JSON
0000s0sJSON::Schema::Modern::Annotation::::__ANON__[:35]JSON::Schema::Modern::Annotation::__ANON__[:35]
0000s0sJSON::Schema::Modern::Annotation::::__ANON__[:62]JSON::Schema::Modern::Annotation::__ANON__[:62]
0000s0sJSON::Schema::Modern::Annotation::::dumpJSON::Schema::Modern::Annotation::dump
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1227µs254µs
# spent 52µs (50+2) within JSON::Schema::Modern::Result::BEGIN@1 which was called: # once (50µs+2µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 1
use strict;
# spent 52µs making 1 call to JSON::Schema::Modern::Result::BEGIN@1 # spent 2µs making 1 call to strict::import
2231µs241µs
# spent 23µs (5+18) within JSON::Schema::Modern::Result::BEGIN@2 which was called: # once (5µs+18µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 2
use warnings;
# spent 23µs making 1 call to JSON::Schema::Modern::Result::BEGIN@2 # spent 18µs making 1 call to warnings::import
3package JSON::Schema::Modern::Annotation;
4# vim: set ts=8 sts=2 sw=2 tw=100 et :
5# ABSTRACT: Contains a single annotation from a JSON Schema evaluation
6
710sour $VERSION = '0.559';
8
9222µs17µs
# spent 7µs within JSON::Schema::Modern::Annotation::BEGIN@9 which was called: # once (7µs+0s) by JSON::Schema::Modern::Result::BEGIN@20 at line 9
use 5.020;
# spent 7µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@9
10219µs2333µs
# spent 169µs (5+164) within JSON::Schema::Modern::Annotation::BEGIN@10 which was called: # once (5µs+164µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 10
use Moo;
# spent 169µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@10 # spent 164µs making 1 call to Moo::import
11336µs31.65ms
# spent 830µs (15+815) within JSON::Schema::Modern::Annotation::BEGIN@11 which was called: # once (15µs+815µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 11
use strictures 2;
# spent 830µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@11 # spent 803µs making 1 call to strictures::import # spent 12µs making 1 call to strictures::VERSION
12262µs2158µs
# spent 82µs (6+76) within JSON::Schema::Modern::Annotation::BEGIN@12 which was called: # once (6µs+76µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 12
use experimental qw(signatures postderef);
# spent 82µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@12 # spent 76µs making 1 call to experimental::import
13221µs237µs
# spent 34µs (11+23) within JSON::Schema::Modern::Annotation::BEGIN@13 which was called: # once (11µs+23µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 13
use if "$]" >= 5.022, experimental => 're_strict';
# spent 34µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@13 # spent 3µs making 1 call to if::import
14220µs231µs
# spent 29µs (14+15) within JSON::Schema::Modern::Annotation::BEGIN@14 which was called: # once (14µs+15µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 14
no if "$]" >= 5.031009, feature => 'indirect';
# spent 29µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@14 # spent 2µs making 1 call to if::unimport
15217µs219µs
# spent 17µs (5+12) within JSON::Schema::Modern::Annotation::BEGIN@15 which was called: # once (5µs+12µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 15
no if "$]" >= 5.033001, feature => 'multidimensional';
# spent 17µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@15 # spent 2µs making 1 call to if::unimport
16213µs217µs
# spent 17µs (8+9) within JSON::Schema::Modern::Annotation::BEGIN@16 which was called: # once (8µs+9µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 16
no if "$]" >= 5.033006, feature => 'bareword_filehandles';
# spent 17µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@16 # spent 0s making 1 call to if::unimport
17216µs2199µs
# spent 102µs (5+97) within JSON::Schema::Modern::Annotation::BEGIN@17 which was called: # once (5µs+97µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 17
use Safe::Isa;
# spent 102µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@17 # spent 97µs making 1 call to Exporter::import
18219µs2804µs
# spent 404µs (4+400) within JSON::Schema::Modern::Annotation::BEGIN@18 which was called: # once (4µs+400µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 18
use MooX::TypeTiny;
# spent 404µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@18 # spent 400µs making 1 call to MooX::TypeTiny::import
19218µs2652µs
# spent 328µs (4+324) within JSON::Schema::Modern::Annotation::BEGIN@19 which was called: # once (4µs+324µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 19
use Types::Standard qw(Str InstanceOf Bool);
# spent 328µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@19 # spent 324µs making 1 call to Exporter::Tiny::import
202300µs2341µs
# spent 174µs (7+167) within JSON::Schema::Modern::Annotation::BEGIN@20 which was called: # once (7µs+167µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 20
use namespace::clean;
# spent 174µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@20 # spent 167µs making 1 call to namespace::clean::import
21
2211µs21.28mshas [qw(
# spent 1.28ms making 1 call to JSON::Schema::Modern::Annotation::has # spent 1µs making 1 call to Types::Standard::Str
23 keyword
24 instance_location
25 keyword_location
26)] => (
27 is => 'ro',
28 isa => Str,
29 required => 1,
30);
31
32has absolute_keyword_location => (
33 is => 'ro',
34 isa => InstanceOf['Mojo::URL'],
35 coerce => sub { $_[0]->$_isa('Mojo::URL') ? $_[0] : Mojo::URL->new($_[0]) },
3613µs2468µs);
# spent 370µs making 1 call to JSON::Schema::Modern::Annotation::has # spent 98µs making 1 call to Types::Standard::InstanceOf
37
38# https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.7.7.1
3911µs1307µshas annotation => (
# spent 307µs making 1 call to JSON::Schema::Modern::Annotation::has
40 is => 'ro',
41 required => 1,
42);
43
4411µs2692µshas unknown => (
# spent 691µs making 1 call to JSON::Schema::Modern::Annotation::has # spent 1µs making 1 call to Types::Standard::Bool
45 is => 'ro',
46 isa => Bool,
47 default => 0,
48);
49
50around BUILDARGS => sub ($orig, $class, @args) {
51 my $args = $class->$orig(@args);
52
53 if (my $uri = delete $args->{_uri}) {
54 # as if we did canonical_uri(..)->to_abs($state->{effective_base_uri} in A(..)
55 $uri = $uri->[0]->to_abs($uri->[1]);
56 undef $uri if $uri eq '' and $args->{keyword_location} eq ''
57 or ($uri->fragment // '') eq $args->{keyword_location} and $uri->clone->fragment(undef) eq '';
58 $args->{absolute_keyword_location} = $uri if defined $uri;
59 }
60
61 return $args;
6212µs1180µs};
# spent 180µs making 1 call to Moo::around
63
64sub TO_JSON ($self) {
65 return +{
66 # note that locations are JSON pointers, not uri fragments!
67 instanceLocation => $self->instance_location,
68 keywordLocation => $self->keyword_location,
69 !defined($self->absolute_keyword_location) ? ()
70 : ( absoluteKeywordLocation => $self->absolute_keyword_location->to_string ),
71 annotation => $self->annotation,
72 };
73}
74
75sub dump ($self) {
76 my $encoder = JSON::MaybeXS->new(utf8 => 0, convert_blessed => 1, canonical => 1, pretty => 1);
77 $encoder->indent_length(2) if $encoder->can('indent_length');
78 $encoder->encode($self);
79}
80
81112µs1;
82117µs1216µs__END__