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

Filename/Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/experimental.pm
StatementsExecuted 604 statements in 5.32ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1113.09ms3.09msexperimental::::BEGIN@7experimental::BEGIN@7
1111.46ms2.18msexperimental::::BEGIN@5experimental::BEGIN@5
7221439µs2.14msexperimental::::_enableexperimental::_enable (recurses: max depth 1, inclusive time 185µs)
361919226µs2.37msexperimental::::importexperimental::import
11133µs37µsexperimental::::BEGIN@3experimental::BEGIN@3
811124µs24µsexperimental::::CORE:matchexperimental::CORE:match (opcode)
11119µs99µsexperimental::::BEGIN@8experimental::BEGIN@8
1115µs30µ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;
211µs$experimental::VERSION = '0.028';
3238µs241µs
# spent 37µs (33+4) within experimental::BEGIN@3 which was called: # once (33µs+4µs) by OpenAPI::Modern::BEGIN@13 at line 3
use strict;
# spent 37µs making 1 call to experimental::BEGIN@3 # spent 4µs making 1 call to strict::import
4219µs255µs
# spent 30µs (5+25) within experimental::BEGIN@4 which was called: # once (5µs+25µs) by OpenAPI::Modern::BEGIN@13 at line 4
use warnings;
# spent 30µs making 1 call to experimental::BEGIN@4 # spent 25µs making 1 call to warnings::import
52283µs12.18ms
# spent 2.18ms (1.46+713µs) within experimental::BEGIN@5 which was called: # once (1.46ms+713µs) by OpenAPI::Modern::BEGIN@13 at line 5
use version ();
# spent 2.18ms making 1 call to experimental::BEGIN@5
6
723.07ms13.09ms
# spent 3.09ms within experimental::BEGIN@7 which was called: # once (3.09ms+0s) by OpenAPI::Modern::BEGIN@13 at line 7
BEGIN { eval { require feature } };
# spent 3.09ms making 1 call to experimental::BEGIN@7
82825µs2179µs
# spent 99µs (19+80) within experimental::BEGIN@8 which was called: # once (19µs+80µs) by OpenAPI::Modern::BEGIN@13 at line 8
use Carp qw/croak carp/;
# spent 99µs making 1 call to experimental::BEGIN@8 # spent 80µs making 1 call to Exporter::import
9
1082263µs8124µsmy %warnings = map { $_ => 1 } grep { /^experimental::/ } keys %warnings::Offsets;
# spent 24µs making 81 calls to experimental::CORE:match, avg 296ns/call
11110µ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
20110µ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
561104µs2856µs$_ = version->new($_) for values %min_version;
# spent 56µs making 28 calls to version::new, avg 2µs/call
5718µs34µs$_ = version->new($_) for values %removed_in_version;
# spent 4µs making 3 calls to version::new, avg 1µs/call
58
5912µsmy %additional = (
60 postderef => ['postderef_qq'],
61 switch => ['smartmatch'],
62 declared_refs => ['refaliasing'],
63);
64
65
# spent 2.14ms (439µs+1.70) within experimental::_enable which was called 72 times, avg 30µs/call: # 54 times (379µs+1.76ms) by experimental::import at line 93, avg 40µs/call # 18 times (60µs+-60µs) by experimental::_enable at line 70, avg 0s/call
sub _enable {
667219µs my $pragma = shift;
6772166µs if ($warnings{"experimental::$pragma"}) {
685477µs54445µs warnings->unimport("experimental::$pragma");
# spent 445µs making 54 calls to warnings::unimport, avg 8µs/call
695464µs181.13ms feature->import($pragma) if exists $features{$pragma};
# spent 1.13ms making 18 calls to feature::import, avg 63µs/call
705444µs180s _enable(@{ $additional{$pragma} }) if $additional{$pragma};
# spent 185µs making 18 calls to experimental::_enable, avg 10µs/call, recursion: max depth 1, sum of overlapping time 185µs
71 }
72 elsif ($features{$pragma}) {
731815µs18125µs feature->import($pragma);
# spent 125µs making 18 calls to feature::import, avg 7µs/call
74188µ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.37ms (226µs+2.14) within experimental::import which was called 36 times, avg 66µs/call: # 18 times (65µs+235µ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 17µs/call # once (7µs+207µs) by JSON::Schema::Modern::Document::BEGIN@12 at line 12 of JSON/Schema/Modern/Document.pm # once (11µs+179µs) by OpenAPI::Modern::BEGIN@13 at line 13 of OpenAPI/Modern.pm # once (11µs+163µs) by JSON::Schema::Modern::Error::BEGIN@12 at line 12 of JSON/Schema/Modern/Error.pm # once (10µs+138µs) by JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Validation.pm # once (9µs+136µs) by JSON::Schema::Modern::Vocabulary::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary.pm # once (33µs+91µs) by JSON::Schema::Modern::Vocabulary::MetaData::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/MetaData.pm # once (10µs+113µs) by JSON::Schema::Modern::BEGIN@13 at line 13 of JSON/Schema/Modern.pm # once (10µs+101µs) by JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 at line 13 of JSON/Schema/Modern/Document/OpenAPI.pm # once (6µs+93µs) by JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/FormatAssertion.pm # once (7µs+91µs) by JSON::Schema::Modern::Result::BEGIN@12 at line 12 of JSON/Schema/Modern/Result.pm # once (8µs+82µs) by JSON::Schema::Modern::Vocabulary::Core::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Core.pm # once (6µs+80µs) by JSON::Schema::Modern::Vocabulary::OpenAPI::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm # once (7µs+78µs) by JSON::Schema::Modern::Vocabulary::FormatAnnotation::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm # once (6µs+75µs) by JSON::Schema::Modern::Utilities::BEGIN@11 at line 11 of JSON/Schema/Modern/Utilities.pm # once (4µs+77µs) by JSON::Schema::Modern::Vocabulary::Unevaluated::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Unevaluated.pm # once (6µs+71µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Applicator.pm # once (5µs+68µs) by JSON::Schema::Modern::Annotation::BEGIN@12 at line 12 of JSON/Schema/Modern/Annotation.pm # once (5µs+65µs) by JSON::Schema::Modern::Vocabulary::Content::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/Content.pm
sub import {
903668µs my ($self, @pragmas) = @_;
91
923624µs for my $pragma (@pragmas) {
935474µs542.14ms _enable($pragma);
# spent 2.14ms making 54 calls to experimental::_enable, avg 40µs/call
94 }
9536109µ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 24µs within experimental::CORE:match which was called 81 times, avg 296ns/call: # 81 times (24µs+0s) by OpenAPI::Modern::BEGIN@13 at line 10, avg 296ns/call
sub experimental::CORE:match; # opcode