← Index
NYTProf Performance Profile   « line view »
For svc/members/upsert
  Run on Tue Jan 13 11:50:22 2015
Reported on Tue Jan 13 12:09:46 2015

Filename/usr/share/perl/5.20/feature.pm
StatementsExecuted 213 statements in 250µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
411188µs188µsfeature::::__commonfeature::__common
41123µs211µsfeature::::importfeature::import
0000s0sfeature::::croakfeature::croak
0000s0sfeature::::unimportfeature::unimport
0000s0sfeature::::unknown_featurefeature::unknown_feature
0000s0sfeature::::unknown_feature_bundlefeature::unknown_feature_bundle
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# -*- buffer-read-only: t -*-
2# !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
3# This file is built by regen/feature.pl.
4# Any changes made here will be lost!
5
6package feature;
7
81700nsour $VERSION = '1.36';
9
1017µsour %feature = (
11 fc => 'feature_fc',
12 say => 'feature_say',
13 state => 'feature_state',
14 switch => 'feature_switch',
15 evalbytes => 'feature_evalbytes',
16 postderef => 'feature_postderef',
17 array_base => 'feature_arybase',
18 signatures => 'feature_signatures',
19 current_sub => 'feature___SUB__',
20 lexical_subs => 'feature_lexsubs',
21 postderef_qq => 'feature_postderef_qq',
22 unicode_eval => 'feature_unieval',
23 unicode_strings => 'feature_unicode',
24);
25
2618µsour %feature_bundle = (
27 "5.10" => [qw(array_base say state switch)],
28 "5.11" => [qw(array_base say state switch unicode_strings)],
29 "5.15" => [qw(current_sub evalbytes fc say state switch unicode_eval unicode_strings)],
30 "all" => [qw(array_base current_sub evalbytes fc lexical_subs postderef postderef_qq say signatures state switch unicode_eval unicode_strings)],
31 "default" => [qw(array_base)],
32);
33
3411µs$feature_bundle{"5.12"} = $feature_bundle{"5.11"};
351400ns$feature_bundle{"5.13"} = $feature_bundle{"5.11"};
361800ns$feature_bundle{"5.14"} = $feature_bundle{"5.11"};
371300ns$feature_bundle{"5.16"} = $feature_bundle{"5.15"};
381300ns$feature_bundle{"5.17"} = $feature_bundle{"5.15"};
391300ns$feature_bundle{"5.18"} = $feature_bundle{"5.15"};
401300ns$feature_bundle{"5.19"} = $feature_bundle{"5.15"};
411300ns$feature_bundle{"5.20"} = $feature_bundle{"5.15"};
421400ns$feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
43
441200nsour $hint_shift = 26;
451100nsour $hint_mask = 0x1c000000;
4611µsour @hint_bundles = qw( default 5.10 5.11 5.15 );
47
48# This gets set (for now) in $^H as well as in %^H,
49# for runtime speed of the uc/lc/ucfirst/lcfirst functions.
50# See HINT_UNI_8_BIT in perl.h.
511200nsour $hint_uni8bit = 0x00000800;
52
53# TODO:
54# - think about versioned features (use feature switch => 2)
55
56
# spent 211µs (23+188) within feature::import which was called 4 times, avg 53µs/call: # 4 times (23µs+188µs) by Modern::Perl::import at line 43 of Modern/Perl.pm, avg 53µs/call
sub import {
5742µs my $class = shift;
58
5941µs if (!@_) {
60 croak("No features specified");
61 }
62
63416µs4188µs __common(1, @_);
# spent 188µs making 4 calls to feature::__common, avg 47µs/call
64}
65
66sub unimport {
67 my $class = shift;
68
69 # A bare C<no feature> should reset to the default bundle
70 if (!@_) {
71 $^H &= ~($hint_uni8bit|$hint_mask);
72 return;
73 }
74
75 __common(0, @_);
76}
77
78
# spent 188µs within feature::__common which was called 4 times, avg 47µs/call: # 4 times (188µs+0s) by feature::import at line 63, avg 47µs/call
sub __common {
7941µs my $import = shift;
8044µs my $bundle_number = $^H & $hint_mask;
8149µs my $features = $bundle_number != $hint_mask
82 && $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]};
8343µs if ($features) {
84 # Features are enabled implicitly via bundle hints.
85 # Delete any keys that may be left over from last time.
86471µs delete @^H{ values(%feature) };
8742µs $^H |= $hint_mask;
8844µs for (@$features) {
8947µs $^H{$feature{$_}} = 1;
9044µs $^H |= $hint_uni8bit if $_ eq 'unicode_strings';
91 }
92 }
93415µs while (@_) {
94246µs my $name = shift;
952413µs if (substr($name, 0, 1) eq ":") {
9642µs my $v = substr($name, 1);
9743µs if (!exists $feature_bundle{$v}) {
98 $v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/;
99 if (!exists $feature_bundle{$v}) {
100 unknown_feature_bundle(substr($name, 1));
101 }
102 }
10349µs unshift @_, @{$feature_bundle{$v}};
10442µs next;
105 }
106205µs if (!exists $feature{$name}) {
107 unknown_feature($name);
108 }
109206µs if ($import) {
1102021µs $^H{$feature{$name}} = 1;
111206µs $^H |= $hint_uni8bit if $name eq 'unicode_strings';
112 } else {
113 delete $^H{$feature{$name}};
114 $^H &= ~ $hint_uni8bit if $name eq 'unicode_strings';
115 }
116 }
117}
118
119sub unknown_feature {
120 my $feature = shift;
121 croak(sprintf('Feature "%s" is not supported by Perl %vd',
122 $feature, $^V));
123}
124
125sub unknown_feature_bundle {
126 my $feature = shift;
127 croak(sprintf('Feature bundle "%s" is not supported by Perl %vd',
128 $feature, $^V));
129}
130
131sub croak {
132 require Carp;
133 Carp::croak(@_);
134}
135
136115µs1;
137
138# ex: set ro: