← Index
NYTProf Performance Profile   « line view »
For -e
  Run on Thu Jun 30 16:16:00 2016
Reported on Thu Jun 30 16:16:08 2016

Filename/home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/experimental.pm
StatementsExecuted 98 statements in 3.56ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1115.82ms6.22msexperimental::::BEGIN@8experimental::BEGIN@8
1112.38ms5.35msexperimental::::BEGIN@5experimental::BEGIN@5
1111.41ms1.41msexperimental::::BEGIN@7experimental::BEGIN@7
11141µs46µsexperimental::::BEGIN@3experimental::BEGIN@3
701118µs18µsexperimental::::CORE:matchexperimental::CORE:match (opcode)
11112µs29µsexperimental::::BEGIN@4experimental::BEGIN@4
11111µs26µsexperimental::::_enableexperimental::_enable
11110µs36µsexperimental::::importexperimental::import
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;
21800ns$experimental::VERSION = '0.016';
3252µs250µs
# spent 46µs (41+5) within experimental::BEGIN@3 which was called: # once (41µs+5µs) by DateTime::Format::Alami::BEGIN@384 at line 3
use strict;
# spent 46µs making 1 call to experimental::BEGIN@3 # spent 4µs making 1 call to strict::import
4241µs246µs
# spent 29µs (12+17) within experimental::BEGIN@4 which was called: # once (12µs+17µs) by DateTime::Format::Alami::BEGIN@384 at line 4
use warnings;
# spent 29µs making 1 call to experimental::BEGIN@4 # spent 17µs making 1 call to warnings::import
52464µs15.35ms
# spent 5.35ms (2.38+2.96) within experimental::BEGIN@5 which was called: # once (2.38ms+2.96ms) by DateTime::Format::Alami::BEGIN@384 at line 5
use version ();
# spent 5.35ms making 1 call to experimental::BEGIN@5
6
721.41ms11.41ms
# spent 1.41ms within experimental::BEGIN@7 which was called: # once (1.41ms+0s) by DateTime::Format::Alami::BEGIN@384 at line 7
use feature ();
# spent 1.41ms making 1 call to experimental::BEGIN@7
821.19ms26.30ms
# spent 6.22ms (5.82+402µs) within experimental::BEGIN@8 which was called: # once (5.82ms+402µs) by DateTime::Format::Alami::BEGIN@384 at line 8
use Carp qw/croak carp/;
# spent 6.22ms making 1 call to experimental::BEGIN@8 # spent 74µs making 1 call to Exporter::import
9
1071206µs7018µsmy %warnings = map { $_ => 1 } grep { /^experimental::/ } keys %warnings::Offsets;
# spent 18µs making 70 calls to experimental::CORE:match, avg 259ns/call
11112µ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
2019µsmy %min_version = (
21 array_base => '5',
22 autoderef => '5.14.0',
23 bitwise => '5.22.0',
24 current_sub => '5.16.0',
25 evalbytes => '5.16.0',
26 fc => '5.16.0',
27 lexical_topic => '5.10.0',
28 lexical_subs => '5.18.0',
29 postderef => '5.20.0',
30 postderef_qq => '5.20.0',
31 refaliasing => '5.22.0',
32 regex_sets => '5.18.0',
33 say => '5.10.0',
34 smartmatch => '5.10.0',
35 signatures => '5.20.0',
36 state => '5.10.0',
37 switch => '5.10.0',
38 unicode_eval => '5.16.0',
39 unicode_strings => '5.12.0',
40);
411900nsmy %max_version = (
42 lexical_topic => '5.23.4',
43);
44
451121µs1965µs$_ = version->new($_) for values %min_version;
# spent 65µs making 19 calls to version::vxs::new, avg 3µs/call
4618µs13µs$_ = version->new($_) for values %max_version;
# spent 3µs making 1 call to version::vxs::new
47
4813µsmy %additional = (
49 postderef => ['postderef_qq'],
50 switch => ['smartmatch'],
51);
52
53
# spent 26µs (11+16) within experimental::_enable which was called: # once (11µs+16µs) by experimental::import at line 85
sub _enable {
541600ns my $pragma = shift;
5516µs if ($warnings{"experimental::$pragma"}) {
5612µs116µs warnings->unimport("experimental::$pragma");
# spent 16µs making 1 call to warnings::unimport
571500ns feature->import($pragma) if exists $features{$pragma};
581500ns _enable(@{ $additional{$pragma} }) if $additional{$pragma};
59 }
60 elsif ($features{$pragma}) {
61 feature->import($pragma);
62 _enable(@{ $additional{$pragma} }) if $additional{$pragma};
63 }
64 elsif (not exists $min_version{$pragma}) {
65 croak "Can't enable unknown feature $pragma";
66 }
67 elsif ($] < $min_version{$pragma}) {
68 my $stable = $min_version{$pragma};
69 if ($stable->{version}[1] % 2) {
70 $stable = version->new(
71 "5.".($stable->{version}[1]+1).'.0'
72 );
73 }
74 croak "Need perl $stable or later for feature $pragma";
75 }
76 elsif ($] >= ($max_version{$pragma} || 7)) {
77 croak "Experimental feature $pragma has been removed from perl in version $max_version{$pragma}";
78 }
79}
80
81
# spent 36µs (10+26) within experimental::import which was called: # once (10µs+26µs) by DateTime::Format::Alami::BEGIN@384 at line 384 of DateTime/Format/Alami.pm
sub import {
8211µs my ($self, @pragmas) = @_;
83
8411µs for my $pragma (@pragmas) {
8512µs126µs _enable($pragma);
# spent 26µs making 1 call to experimental::_enable
86 }
8714µs return;
88}
89
90sub _disable {
91 my $pragma = shift;
92 if ($warnings{"experimental::$pragma"}) {
93 warnings->import("experimental::$pragma");
94 feature->unimport($pragma) if exists $features{$pragma};
95 _disable(@{ $additional{$pragma} }) if $additional{$pragma};
96 }
97 elsif ($features{$pragma}) {
98 feature->unimport($pragma);
99 _disable(@{ $additional{$pragma} }) if $additional{$pragma};
100 }
101 elsif (not exists $min_version{$pragma}) {
102 carp "Can't disable unknown feature $pragma, ignoring";
103 }
104}
105
106sub unimport {
107 my ($self, @pragmas) = @_;
108
109 for my $pragma (@pragmas) {
110 _disable($pragma);
111 }
112 return;
113}
114
115121µs1;
116
117#ABSTRACT: Experimental features made easy
118
119__END__
 
# spent 18µs within experimental::CORE:match which was called 70 times, avg 259ns/call: # 70 times (18µs+0s) by DateTime::Format::Alami::BEGIN@384 at line 10, avg 259ns/call
sub experimental::CORE:match; # opcode