← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 16:10:05 2022
Reported on Wed Dec 14 16:12:58 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Annotation.pm
StatementsExecuted 36 statements in 982µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11119µs22µsJSON::Schema::Modern::Result::::BEGIN@1 JSON::Schema::Modern::Result::BEGIN@1
11113µs637µsJSON::Schema::Modern::Annotation::::BEGIN@11JSON::Schema::Modern::Annotation::BEGIN@11
11111µs32µsJSON::Schema::Modern::Annotation::::BEGIN@13JSON::Schema::Modern::Annotation::BEGIN@13
11110µs10µsJSON::Schema::Modern::Annotation::::BEGIN@9JSON::Schema::Modern::Annotation::BEGIN@9
1119µs12µsJSON::Schema::Modern::Annotation::::BEGIN@16JSON::Schema::Modern::Annotation::BEGIN@16
1118µs21µsJSON::Schema::Modern::Annotation::::BEGIN@14JSON::Schema::Modern::Annotation::BEGIN@14
1118µs14µsJSON::Schema::Modern::Annotation::::BEGIN@15JSON::Schema::Modern::Annotation::BEGIN@15
1117µs213µsJSON::Schema::Modern::Annotation::::BEGIN@10JSON::Schema::Modern::Annotation::BEGIN@10
1117µs80µsJSON::Schema::Modern::Annotation::::BEGIN@12JSON::Schema::Modern::Annotation::BEGIN@12
1117µs387µsJSON::Schema::Modern::Annotation::::BEGIN@19JSON::Schema::Modern::Annotation::BEGIN@19
1117µs200µsJSON::Schema::Modern::Annotation::::BEGIN@20JSON::Schema::Modern::Annotation::BEGIN@20
1116µs300µsJSON::Schema::Modern::Annotation::::BEGIN@18JSON::Schema::Modern::Annotation::BEGIN@18
1115µs86µsJSON::Schema::Modern::Annotation::::BEGIN@17JSON::Schema::Modern::Annotation::BEGIN@17
1114µs28µsJSON::Schema::Modern::Result::::BEGIN@2 JSON::Schema::Modern::Result::BEGIN@2
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
1222µs225µs
# spent 22µs (19+3) within JSON::Schema::Modern::Result::BEGIN@1 which was called: # once (19µs+3µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 1
use strict;
# spent 22µs making 1 call to JSON::Schema::Modern::Result::BEGIN@1 # spent 3µs making 1 call to strict::import
2235µs252µs
# spent 28µs (4+24) within JSON::Schema::Modern::Result::BEGIN@2 which was called: # once (4µs+24µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 2
use warnings;
# spent 28µs making 1 call to JSON::Schema::Modern::Result::BEGIN@2 # spent 24µ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.558';
8
9231µs110µs
# spent 10µs within JSON::Schema::Modern::Annotation::BEGIN@9 which was called: # once (10µs+0s) by JSON::Schema::Modern::Result::BEGIN@20 at line 9
use 5.020;
# spent 10µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@9
10224µs2419µs
# spent 213µs (7+206) within JSON::Schema::Modern::Annotation::BEGIN@10 which was called: # once (7µs+206µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 10
use Moo;
# spent 213µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@10 # spent 206µs making 1 call to Moo::import
11326µs31.26ms
# spent 637µs (13+624) within JSON::Schema::Modern::Annotation::BEGIN@11 which was called: # once (13µs+624µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 11
use strictures 2;
# spent 637µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@11 # spent 609µs making 1 call to strictures::import # spent 15µs making 1 call to strictures::VERSION
12231µs2153µs
# spent 80µs (7+73) within JSON::Schema::Modern::Annotation::BEGIN@12 which was called: # once (7µs+73µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 12
use experimental qw(signatures postderef);
# spent 80µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@12 # spent 73µs making 1 call to experimental::import
13226µs234µs
# spent 32µs (11+21) within JSON::Schema::Modern::Annotation::BEGIN@13 which was called: # once (11µs+21µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 13
use if "$]" >= 5.022, experimental => 're_strict';
# spent 32µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@13 # spent 2µs making 1 call to if::import
14218µs223µs
# spent 21µs (8+13) within JSON::Schema::Modern::Annotation::BEGIN@14 which was called: # once (8µs+13µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 14
no if "$]" >= 5.031009, feature => 'indirect';
# spent 21µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@14 # spent 2µs making 1 call to if::unimport
15216µs214µs
# spent 14µs (8+6) within JSON::Schema::Modern::Annotation::BEGIN@15 which was called: # once (8µs+6µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 15
no if "$]" >= 5.033001, feature => 'multidimensional';
# spent 14µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@15 # spent 0s making 1 call to if::unimport
16212µs212µs
# spent 12µs (9+3) within JSON::Schema::Modern::Annotation::BEGIN@16 which was called: # once (9µs+3µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 16
no if "$]" >= 5.033006, feature => 'bareword_filehandles';
# spent 12µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@16 # spent 0s making 1 call to if::unimport
17216µs2167µs
# spent 86µs (5+81) within JSON::Schema::Modern::Annotation::BEGIN@17 which was called: # once (5µs+81µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 17
use Safe::Isa;
# spent 86µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@17 # spent 81µs making 1 call to Exporter::import
18221µs2594µs
# spent 300µs (6+294) within JSON::Schema::Modern::Annotation::BEGIN@18 which was called: # once (6µs+294µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 18
use MooX::TypeTiny;
# spent 300µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@18 # spent 294µs making 1 call to MooX::TypeTiny::import
19223µs2767µs
# spent 387µs (7+380) within JSON::Schema::Modern::Annotation::BEGIN@19 which was called: # once (7µs+380µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 19
use Types::Standard qw(Str InstanceOf Bool);
# spent 387µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@19 # spent 380µs making 1 call to Exporter::Tiny::import
202621µs2393µs
# spent 200µs (7+193) within JSON::Schema::Modern::Annotation::BEGIN@20 which was called: # once (7µs+193µs) by JSON::Schema::Modern::Result::BEGIN@20 at line 20
use namespace::clean;
# spent 200µs making 1 call to JSON::Schema::Modern::Annotation::BEGIN@20 # spent 193µs making 1 call to namespace::clean::import
21
2214µs21.74mshas [qw(
# spent 1.74ms making 1 call to JSON::Schema::Modern::Annotation::has # spent 3µ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]) },
3615µs2357µs);
# spent 286µs making 1 call to JSON::Schema::Modern::Annotation::has # spent 71µ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
3912µs1506µshas annotation => (
# spent 506µs making 1 call to JSON::Schema::Modern::Annotation::has
40 is => 'ro',
41 required => 1,
42);
43
4413µs2758µshas unknown => (
# spent 756µs making 1 call to JSON::Schema::Modern::Annotation::has # spent 2µ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;
6214µs1263µs};
# spent 263µ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
81116µs1;
82
83126µs1405µs__END__