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

Filename/Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/experimental.pm
StatementsExecuted 604 statements in 4.45ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.33ms2.33msexperimental::::BEGIN@7experimental::BEGIN@7
1112.09ms3.24msexperimental::::BEGIN@5experimental::BEGIN@5
7221451µs1.83msexperimental::::_enableexperimental::_enable (recurses: max depth 1, inclusive time 184µs)
361919148µs1.98msexperimental::::importexperimental::import
11135µs79µsexperimental::::BEGIN@8experimental::BEGIN@8
811121µs21µsexperimental::::CORE:matchexperimental::CORE:match (opcode)
11117µs19µsexperimental::::BEGIN@3experimental::BEGIN@3
1112µs13µ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';
3217µs221µs
# spent 19µs (17+2) within experimental::BEGIN@3 which was called: # once (17µs+2µs) by OpenAPI::Modern::BEGIN@13 at line 3
use strict;
# spent 19µs making 1 call to experimental::BEGIN@3 # spent 2µs making 1 call to strict::import
4212µs224µs
# spent 13µs (2+11) within experimental::BEGIN@4 which was called: # once (2µs+11µs) by OpenAPI::Modern::BEGIN@13 at line 4
use warnings;
# spent 13µs making 1 call to experimental::BEGIN@4 # spent 11µs making 1 call to warnings::import
52480µs13.24ms
# spent 3.24ms (2.09+1.15) within experimental::BEGIN@5 which was called: # once (2.09ms+1.15ms) by OpenAPI::Modern::BEGIN@13 at line 5
use version ();
# spent 3.24ms making 1 call to experimental::BEGIN@5
6
722.34ms12.33ms
# spent 2.33ms within experimental::BEGIN@7 which was called: # once (2.33ms+0s) by OpenAPI::Modern::BEGIN@13 at line 7
BEGIN { eval { require feature } };
# spent 2.33ms making 1 call to experimental::BEGIN@7
82546µs2123µs
# spent 79µs (35+44) within experimental::BEGIN@8 which was called: # once (35µs+44µs) by OpenAPI::Modern::BEGIN@13 at line 8
use Carp qw/croak carp/;
# spent 79µs making 1 call to experimental::BEGIN@8 # spent 44µs making 1 call to Exporter::import
9
1082272µs8121µsmy %warnings = map { $_ => 1 } grep { /^experimental::/ } keys %warnings::Offsets;
# spent 21µs making 81 calls to experimental::CORE:match, avg 259ns/call
11116µ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
20135µ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);
5013µsmy %removed_in_version = (
51 array_base => '5.30.0',
52 autoderef => '5.24.0',
53 lexical_topic => '5.24.0',
54);
55
561121µs2856µs$_ = version->new($_) for values %min_version;
# spent 56µs making 28 calls to version::new, avg 2µs/call
57110µs33µs$_ = version->new($_) for values %removed_in_version;
# spent 3µ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 1.83ms (451µs+1.38) within experimental::_enable which was called 72 times, avg 25µs/call: # 54 times (343µs+1.49ms) by experimental::import at line 93, avg 34µs/call # 18 times (108µs+-108µs) by experimental::_enable at line 70, avg 0s/call
sub _enable {
667219µs my $pragma = shift;
6772135µs if ($warnings{"experimental::$pragma"}) {
685484µs54338µs warnings->unimport("experimental::$pragma");
# spent 338µs making 54 calls to warnings::unimport, avg 6µs/call
695452µs18967µs feature->import($pragma) if exists $features{$pragma};
# spent 967µs making 18 calls to feature::import, avg 54µs/call
705446µs180s _enable(@{ $additional{$pragma} }) if $additional{$pragma};
# spent 184µs making 18 calls to experimental::_enable, avg 10µs/call, recursion: max depth 1, sum of overlapping time 184µs
71 }
72 elsif ($features{$pragma}) {
731833µs1876µs feature->import($pragma);
# spent 76µs making 18 calls to feature::import, avg 4µs/call
74185µ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 1.98ms (148µs+1.83) within experimental::import which was called 36 times, avg 55µs/call: # 18 times (41µs+167µ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 12µs/call # once (6µs+178µs) by JSON::Schema::Modern::Document::OpenAPI::BEGIN@13 at line 13 of JSON/Schema/Modern/Document/OpenAPI.pm # once (8µs+145µs) by OpenAPI::Modern::BEGIN@13 at line 13 of OpenAPI/Modern.pm # once (7µs+131µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Applicator.pm # once (8µs+98µs) by JSON::Schema::Modern::Utilities::BEGIN@11 at line 11 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Utilities.pm # once (6µs+95µs) by JSON::Schema::Modern::Vocabulary::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary.pm # once (6µs+93µs) by JSON::Schema::Modern::Vocabulary::Validation::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Validation.pm # once (9µs+87µs) by JSON::Schema::Modern::Vocabulary::Unevaluated::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Unevaluated.pm # once (6µs+85µs) by JSON::Schema::Modern::Vocabulary::MetaData::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/MetaData.pm # once (5µs+83µs) by JSON::Schema::Modern::Vocabulary::Core::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Core.pm # once (5µs+81µs) by JSON::Schema::Modern::Document::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Document.pm # once (7µs+79µs) by JSON::Schema::Modern::Vocabulary::FormatAnnotation::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm # once (4µs+82µs) by JSON::Schema::Modern::Result::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Result.pm # once (4µs+78µs) by JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/FormatAssertion.pm # once (4µs+77µs) by JSON::Schema::Modern::BEGIN@13 at line 13 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern.pm # once (7µs+73µs) by JSON::Schema::Modern::Error::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Error.pm # once (6µs+70µs) by JSON::Schema::Modern::Annotation::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Annotation.pm # once (6µs+67µs) by JSON::Schema::Modern::Vocabulary::OpenAPI::BEGIN@12 at line 12 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm # once (3µs+63µs) by JSON::Schema::Modern::Vocabulary::Content::BEGIN@12 at line 12 of /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Vocabulary/Content.pm
sub import {
903625µs my ($self, @pragmas) = @_;
91
923617µs for my $pragma (@pragmas) {
935457µs541.83ms _enable($pragma);
# spent 1.83ms making 54 calls to experimental::_enable, avg 34µs/call
94 }
9536101µ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
123129µ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