Filename | /Users/ether/perl5/perlbrew/perls/36.0/lib/5.36.0/experimental.pm |
Statements | Executed 604 statements in 4.45ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 2.33ms | 2.33ms | BEGIN@7 | experimental::
1 | 1 | 1 | 2.09ms | 3.24ms | BEGIN@5 | experimental::
72 | 2 | 1 | 451µs | 1.83ms | _enable (recurses: max depth 1, inclusive time 184µs) | experimental::
36 | 19 | 19 | 148µs | 1.98ms | import | experimental::
1 | 1 | 1 | 35µs | 79µs | BEGIN@8 | experimental::
81 | 1 | 1 | 21µs | 21µs | CORE:match (opcode) | experimental::
1 | 1 | 1 | 17µs | 19µs | BEGIN@3 | experimental::
1 | 1 | 1 | 2µs | 13µ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 | 17µs | 2 | 21µ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 # spent 19µs making 1 call to experimental::BEGIN@3
# spent 2µs making 1 call to strict::import |
4 | 2 | 12µs | 2 | 24µ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 # spent 13µs making 1 call to experimental::BEGIN@4
# spent 11µs making 1 call to warnings::import |
5 | 2 | 480µs | 1 | 3.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 # spent 3.24ms making 1 call to experimental::BEGIN@5 |
6 | |||||
7 | 2 | 2.34ms | 1 | 2.33ms | # spent 2.33ms within experimental::BEGIN@7 which was called:
# once (2.33ms+0s) by OpenAPI::Modern::BEGIN@13 at line 7 # spent 2.33ms making 1 call to experimental::BEGIN@7 |
8 | 2 | 546µs | 2 | 123µ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 # spent 79µs making 1 call to experimental::BEGIN@8
# spent 44µs making 1 call to Exporter::import |
9 | |||||
10 | 82 | 272µ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 | 16µ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 | 35µ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 | 3µs | 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 | 121µs | 28 | 56µs | $_ = version->new($_) for values %min_version; # spent 56µs making 28 calls to version::new, avg 2µs/call |
57 | 1 | 10µs | 3 | 3µs | $_ = version->new($_) for values %removed_in_version; # spent 3µs making 3 calls to version::new, avg 1µ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 | 19µs | my $pragma = shift; | ||
67 | 72 | 135µs | if ($warnings{"experimental::$pragma"}) { | ||
68 | 54 | 84µs | 54 | 338µs | warnings->unimport("experimental::$pragma"); # spent 338µs making 54 calls to warnings::unimport, avg 6µs/call |
69 | 54 | 52µs | 18 | 967µs | feature->import($pragma) if exists $features{$pragma}; # spent 967µs making 18 calls to feature::import, avg 54µs/call |
70 | 54 | 46µs | 18 | 0s | _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}) { | ||||
73 | 18 | 33µs | 18 | 76µs | feature->import($pragma); # spent 76µs making 18 calls to feature::import, avg 4µs/call |
74 | 18 | 5µ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 | ||||
90 | 36 | 25µs | my ($self, @pragmas) = @_; | ||
91 | |||||
92 | 36 | 17µs | for my $pragma (@pragmas) { | ||
93 | 54 | 57µs | 54 | 1.83ms | _enable($pragma); # spent 1.83ms making 54 calls to experimental::_enable, avg 34µs/call |
94 | } | ||||
95 | 36 | 101µ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 | 29µ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 |