Filename | /Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/experimental.pm |
Statements | Executed 604 statements in 5.52ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 3.19ms | 3.19ms | BEGIN@7 | experimental::
1 | 1 | 1 | 1.70ms | 2.48ms | BEGIN@5 | experimental::
72 | 2 | 1 | 557µs | 2.42ms | _enable (recurses: max depth 1, inclusive time 260µs) | experimental::
36 | 19 | 19 | 227µs | 2.65ms | import | experimental::
1 | 1 | 1 | 50µs | 57µs | BEGIN@3 | experimental::
81 | 1 | 1 | 21µs | 21µs | CORE:match (opcode) | experimental::
1 | 1 | 1 | 10µs | 47µs | BEGIN@8 | experimental::
1 | 1 | 1 | 9µs | 69µs | BEGIN@4 | experimental::
0 | 0 | 0 | 0s | 0s | _disable | experimental::
0 | 0 | 0 | 0s | 0s | unimport | experimental::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package experimental; | ||||
2 | 1 | 0s | $experimental::VERSION = '0.028'; | ||
3 | 2 | 43µs | 2 | 64µ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 # spent 57µs making 1 call to experimental::BEGIN@3
# spent 7µs making 1 call to strict::import |
4 | 2 | 23µs | 2 | 129µ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 # spent 69µs making 1 call to experimental::BEGIN@4
# spent 60µs making 1 call to warnings::import |
5 | 2 | 324µs | 1 | 2.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 # spent 2.48ms making 1 call to experimental::BEGIN@5 |
6 | |||||
7 | 2 | 3.16ms | 1 | 3.19ms | # spent 3.19ms within experimental::BEGIN@7 which was called:
# once (3.19ms+0s) by OpenAPI::Modern::BEGIN@13 at line 7 # spent 3.19ms making 1 call to experimental::BEGIN@7 |
8 | 2 | 801µs | 2 | 84µ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 # spent 47µs making 1 call to experimental::BEGIN@8
# spent 37µs making 1 call to Exporter::import |
9 | |||||
10 | 82 | 233µs | 81 | 21µs | my %warnings = map { $_ => 1 } grep { /^experimental::/ } keys %warnings::Offsets; # spent 21µs making 81 calls to experimental::CORE:match, avg 259ns/call |
11 | 1 | 9µs | my %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 | |||||
20 | 1 | 8µs | my %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 | ); | ||||
50 | 1 | 0s | my %removed_in_version = ( | ||
51 | array_base => '5.30.0', | ||||
52 | autoderef => '5.24.0', | ||||
53 | lexical_topic => '5.24.0', | ||||
54 | ); | ||||
55 | |||||
56 | 1 | 115µs | 28 | 63µs | $_ = version->new($_) for values %min_version; # spent 63µs making 28 calls to version::new, avg 2µs/call |
57 | 1 | 11µs | 3 | 5µs | $_ = version->new($_) for values %removed_in_version; # spent 5µs making 3 calls to version::new, avg 2µs/call |
58 | |||||
59 | 1 | 2µs | my %additional = ( | ||
60 | postderef => ['postderef_qq'], | ||||
61 | switch => ['smartmatch'], | ||||
62 | declared_refs => ['refaliasing'], | ||||
63 | ); | ||||
64 | |||||
65 | sub _enable { | ||||
66 | 72 | 18µs | my $pragma = shift; | ||
67 | 72 | 185µs | if ($warnings{"experimental::$pragma"}) { | ||
68 | 54 | 70µs | 54 | 498µs | warnings->unimport("experimental::$pragma"); # spent 498µs making 54 calls to warnings::unimport, avg 9µs/call |
69 | 54 | 114µs | 18 | 1.21ms | feature->import($pragma) if exists $features{$pragma}; # spent 1.21ms making 18 calls to feature::import, avg 67µs/call |
70 | 54 | 73µs | 18 | 0s | _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}) { | ||||
73 | 18 | 28µs | 18 | 151µs | feature->import($pragma); # spent 151µs making 18 calls to feature::import, avg 8µs/call |
74 | 18 | 6µ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 | ||||
90 | 36 | 36µs | my ($self, @pragmas) = @_; | ||
91 | |||||
92 | 36 | 34µs | for my $pragma (@pragmas) { | ||
93 | 54 | 84µs | 54 | 2.42ms | _enable($pragma); # spent 2.42ms making 54 calls to experimental::_enable, avg 45µs/call |
94 | } | ||||
95 | 36 | 122µs | return; | ||
96 | } | ||||
97 | |||||
98 | sub _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 | |||||
114 | sub unimport { | ||||
115 | my ($self, @pragmas) = @_; | ||||
116 | |||||
117 | for my $pragma (@pragmas) { | ||||
118 | _disable($pragma); | ||||
119 | } | ||||
120 | return; | ||||
121 | } | ||||
122 | |||||
123 | 1 | 24µs | 1; | ||
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 |