← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Wed Dec 14 15:57:08 2022
Reported on Wed Dec 14 16:00:30 2022

Filename/Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/experimental.pm
StatementsExecuted 604 statements in 5.52ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.19ms3.19msexperimental::::BEGIN@7experimental::BEGIN@7
1111.70ms2.48msexperimental::::BEGIN@5experimental::BEGIN@5
7221557µs2.42msexperimental::::_enableexperimental::_enable (recurses: max depth 1, inclusive time 260µs)
361919227µs2.65msexperimental::::importexperimental::import
11150µs57µsexperimental::::BEGIN@3experimental::BEGIN@3
811121µs21µsexperimental::::CORE:matchexperimental::CORE:match (opcode)
11110µs47µsexperimental::::BEGIN@8experimental::BEGIN@8
1119µs69µsexperimental::::BEGIN@4experimental::BEGIN@4
0000s0sexperimental::::_disableexperimental::_disable
0000s0sexperimental::::unimportexperimental::unimport
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package experimental;
210s$experimental::VERSION = '0.028';
3243µs264µs
# spent 57µs (50+7) within experimental::BEGIN@3 which was called: # once (50µs+7µs) by OpenAPI::Modern::BEGIN@13 at line 3
use strict;
# spent 57µs making 1 call to experimental::BEGIN@3 # spent 7µs making 1 call to strict::import
4223µs2129µs
# spent 69µs (9+60) within experimental::BEGIN@4 which was called: # once (9µs+60µs) by OpenAPI::Modern::BEGIN@13 at line 4
use warnings;
# spent 69µs making 1 call to experimental::BEGIN@4 # spent 60µs making 1 call to warnings::import
52324µs12.48ms
# spent 2.48ms (1.70+775µs) within experimental::BEGIN@5 which was called: # once (1.70ms+775µs) by OpenAPI::Modern::BEGIN@13 at line 5
use version ();
# spent 2.48ms making 1 call to experimental::BEGIN@5
6
723.16ms13.19ms
# spent 3.19ms within experimental::BEGIN@7 which was called: # once (3.19ms+0s) by OpenAPI::Modern::BEGIN@13 at line 7
BEGIN { eval { require feature } };
# spent 3.19ms making 1 call to experimental::BEGIN@7
82801µs284µs
# spent 47µs (10+37) within experimental::BEGIN@8 which was called: # once (10µs+37µs) by OpenAPI::Modern::BEGIN@13 at line 8
use Carp qw/croak carp/;
# spent 47µs making 1 call to experimental::BEGIN@8 # spent 37µs making 1 call to Exporter::import
9
1082233µs8121µsmy %warnings = map { $_ => 1 } grep { /^experimental::/ } keys %warnings::Offsets;
# spent 21µs making 81 calls to experimental::CORE:match, avg 259ns/call
1119µsmy %features = map { $_ => 1 } $] > 5.015006 ? keys %feature::feature : do {
12 my @features;
13 if ($] >= 5.010) {
14 push @features, qw/switch say state/;
15 push @features, 'unicode_strings' if $] > 5.011002;
16 }
17 @features;
18};
19
2018µsmy %min_version = (
21 args_array_with_signatures => '5.20.0',
22 array_base => '5',
23 autoderef => '5.14.0',
24 bitwise => '5.22.0',
25 builtin => '5.35.7',
26 const_attr => '5.22.0',
27 current_sub => '5.16.0',
28 declared_refs => '5.26.0',
29 defer => '5.35.4',
30 evalbytes => '5.16.0',
31 extra_paired_delims => '5.35.9',
32 fc => '5.16.0',
33 for_list => '5.35.5',
34 isa => '5.31.7',
35 lexical_topic => '5.10.0',
36 lexical_subs => '5.18.0',
37 postderef => '5.20.0',
38 postderef_qq => '5.20.0',
39 refaliasing => '5.22.0',
40 regex_sets => '5.18.0',
41 say => '5.10.0',
42 smartmatch => '5.10.0',
43 signatures => '5.20.0',
44 state => '5.10.0',
45 switch => '5.10.0',
46 try => '5.34.0',
47 unicode_eval => '5.16.0',
48 unicode_strings => '5.12.0',
49);
5010smy %removed_in_version = (
51 array_base => '5.30.0',
52 autoderef => '5.24.0',
53 lexical_topic => '5.24.0',
54);
55
561115µs2863µs$_ = version->new($_) for values %min_version;
# spent 63µs making 28 calls to version::new, avg 2µs/call
57111µs35µs$_ = version->new($_) for values %removed_in_version;
# spent 5µs making 3 calls to version::new, avg 2µs/call
58
5912µsmy %additional = (
60 postderef => ['postderef_qq'],
61 switch => ['smartmatch'],
62 declared_refs => ['refaliasing'],
63);
64
65
# spent 2.42ms (557µs+1.86) within experimental::_enable which was called 72 times, avg 34µs/call: # 54 times (448µs+1.97ms) by experimental::import at line 93, avg 45µs/call # 18 times (109µs+-109µs) by experimental::_enable at line 70, avg 0s/call
sub _enable {
667218µs my $pragma = shift;
6772185µs if ($warnings{"experimental::$pragma"}) {
685470µs54498µs warnings->unimport("experimental::$pragma");
# spent 498µs making 54 calls to warnings::unimport, avg 9µs/call
6954114µs181.21ms feature->import($pragma) if exists $features{$pragma};
# spent 1.21ms making 18 calls to feature::import, avg 67µs/call
705473µs180s _enable(@{ $additional{$pragma} }) if $additional{$pragma};
# spent 260µs making 18 calls to experimental::_enable, avg 14µs/call, recursion: max depth 1, sum of overlapping time 260µs
71 }
72 elsif ($features{$pragma}) {
731828µs18151µs feature->import($pragma);
# spent 151µs making 18 calls to feature::import, avg 8µs/call
74186µs _enable(@{ $additional{$pragma} }) if $additional{$pragma};
75 }
76 elsif (not exists $min_version{$pragma}) {
77 croak "Can't enable unknown feature $pragma";
78 }
79 elsif ($] < $min_version{$pragma}) {
80 my $stable = $min_version{$pragma}->stringify;
81 $stable =~ s/^ 5\. ([0-9]?[13579]) \. \d+ $/"5." . ($1 + 1) . ".0"/xe;
82 croak "Need perl $stable or later for feature $pragma";
83 }
84 elsif ($] >= ($removed_in_version{$pragma} || 7)) {
85 croak "Experimental feature $pragma has been removed from perl in version $removed_in_version{$pragma}";
86 }
87}
88
89
# spent 2.65ms (227µs+2.42) within experimental::import which was called 36 times, avg 74µs/call: # 18 times (83µs+197µs) by JSON::Schema::Modern::Annotation::BEGIN@13 or JSON::Schema::Modern::BEGIN@14 or JSON::Schema::Modern::Document::BEGIN@13 or JSON::Schema::Modern::Document::OpenAPI::BEGIN@14 or JSON::Schema::Modern::Error::BEGIN@13 or JSON::Schema::Modern::Result::BEGIN@13 or JSON::Schema::Modern::Utilities::BEGIN@12 or JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@13 or JSON::Schema::Modern::Vocabulary::BEGIN@13 or JSON::Schema::Modern::Vocabulary::Content::BEGIN@13 or JSON::Schema::Modern::Vocabulary::Core::BEGIN@13 or JSON::Schema::Modern::Vocabulary::FormatAnnotation::BEGIN@13 or JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@13 or JSON::Schema::Modern::Vocabulary::MetaData::BEGIN@13 or JSON::Schema::Modern::Vocabulary::OpenAPI::BEGIN@13 or JSON::Schema::Modern::Vocabulary::Unevaluated::BEGIN@13 or JSON::Schema::Modern::Vocabulary::Validation::BEGIN@13 or OpenAPI::Modern::BEGIN@14 at line 17 of if.pm, avg 16µs/call # once (12µs+229µs) by JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Validation.pm # once (9µs+191µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Applicator.pm # once (10µs+171µs) by JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/FormatAssertion.pm # once (9µs+169µs) by OpenAPI::Modern::BEGIN@13 at line 13 of OpenAPI/Modern.pm # once (7µs+157µs) by JSON::Schema::Modern::Vocabulary::Core::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Core.pm # once (10µs+128µs) by JSON::Schema::Modern::Utilities::BEGIN@11 at line 11 of JSON/Schema/Modern/Utilities.pm # once (9µs+127µs) by JSON::Schema::Modern::Document::BEGIN@12 at line 12 of JSON/Schema/Modern/Document.pm # once (9µs+125µs) by JSON::Schema::Modern::BEGIN@13 at line 13 of JSON/Schema/Modern.pm # once (9µs+120µs) by JSON::Schema::Modern::Annotation::BEGIN@12 at line 12 of JSON/Schema/Modern/Annotation.pm # once (7µs+104µs) by JSON::Schema::Modern::Vocabulary::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary.pm # once (9µs+97µs) by JSON::Schema::Modern::Vocabulary::Content::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Content.pm # once (6µs+98µs) by JSON::Schema::Modern::Vocabulary::OpenAPI::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm # once (8µs+93µs) by JSON::Schema::Modern::Vocabulary::Unevaluated::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Unevaluated.pm # once (7µs+87µs) by JSON::Schema::Modern::Vocabulary::FormatAnnotation::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm # once (6µs+85µs) by JSON::Schema::Modern::Vocabulary::MetaData::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/MetaData.pm # once (6µs+85µs) by JSON::Schema::Modern::Result::BEGIN@12 at line 12 of JSON/Schema/Modern/Result.pm # once (7µs+80µs) by JSON::Schema::Modern::Error::BEGIN@12 at line 12 of JSON/Schema/Modern/Error.pm # once (4µs+77µs) by JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 at line 13 of JSON/Schema/Modern/Document/OpenAPI.pm
sub import {
903636µs my ($self, @pragmas) = @_;
91
923634µs for my $pragma (@pragmas) {
935484µs542.42ms _enable($pragma);
# spent 2.42ms making 54 calls to experimental::_enable, avg 45µs/call
94 }
9536122µs return;
96}
97
98sub _disable {
99 my $pragma = shift;
100 if ($warnings{"experimental::$pragma"}) {
101 warnings->import("experimental::$pragma");
102 feature->unimport($pragma) if exists $features{$pragma};
103 _disable(@{ $additional{$pragma} }) if $additional{$pragma};
104 }
105 elsif ($features{$pragma}) {
106 feature->unimport($pragma);
107 _disable(@{ $additional{$pragma} }) if $additional{$pragma};
108 }
109 elsif (not exists $min_version{$pragma}) {
110 carp "Can't disable unknown feature $pragma, ignoring";
111 }
112}
113
114sub unimport {
115 my ($self, @pragmas) = @_;
116
117 for my $pragma (@pragmas) {
118 _disable($pragma);
119 }
120 return;
121}
122
123124µs1;
124
125#ABSTRACT: Experimental features made easy
126
127__END__
 
# spent 21µs within experimental::CORE:match which was called 81 times, avg 259ns/call: # 81 times (21µs+0s) by OpenAPI::Modern::BEGIN@13 at line 10, avg 259ns/call
sub experimental::CORE:match; # opcode