Filename | /home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Eval/Closure.pm |
Statements | Executed 7871 statements in 30.8ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
208 | 1 | 1 | 17.1ms | 17.1ms | _clean_eval | Eval::Closure::
208 | 2 | 2 | 9.01ms | 31.3ms | eval_closure | Eval::Closure::
208 | 1 | 1 | 1.91ms | 20.9ms | _clean_eval_closure | Eval::Closure::
208 | 1 | 1 | 824µs | 18.6ms | _make_compiler | Eval::Closure::
208 | 1 | 1 | 601µs | 646µs | _canonicalize_source | Eval::Closure::
208 | 1 | 1 | 597µs | 718µs | _validate_env | Eval::Closure::
208 | 1 | 1 | 565µs | 736µs | _make_compiler_source | Eval::Closure::
57 | 1 | 1 | 171µs | 171µs | _make_lexical_assignment | Eval::Closure::
208 | 1 | 1 | 69µs | 69µs | CORE:sort (opcode) | Eval::Closure::
57 | 1 | 1 | 55µs | 55µs | CORE:match (opcode) | Eval::Closure::
1 | 1 | 1 | 7µs | 14µs | BEGIN@10 | Eval::Closure::
1 | 1 | 1 | 7µs | 45µs | BEGIN@18 | Eval::Closure::
1 | 1 | 1 | 6µs | 34µs | BEGIN@13 | Eval::Closure::
1 | 1 | 1 | 5µs | 7µs | BEGIN@7 | Eval::Closure::
1 | 1 | 1 | 4µs | 4µs | BEGIN@2 | Eval::Closure::
1 | 1 | 1 | 4µs | 20µs | BEGIN@16 | Eval::Closure::
1 | 1 | 1 | 4µs | 18µs | BEGIN@15 | Eval::Closure::
1 | 1 | 1 | 4µs | 5µs | BEGIN@6 | Eval::Closure::
1 | 1 | 1 | 2µs | 2µs | BEGIN@14 | Eval::Closure::
0 | 0 | 0 | 0s | 0s | __ANON__[:185] | Eval::Closure::
0 | 0 | 0 | 0s | 0s | _dump_source | Eval::Closure::
0 | 0 | 0 | 0s | 0s | _line_directive | Eval::Closure::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Eval::Closure; | ||||
2 | # spent 4µs within Eval::Closure::BEGIN@2 which was called:
# once (4µs+0s) by Class::MOP::Method::Generated::BEGIN@7 at line 4 | ||||
3 | 1 | 3µs | $Eval::Closure::AUTHORITY = 'cpan:DOY'; | ||
4 | 1 | 14µs | 1 | 4µs | } # spent 4µs making 1 call to Eval::Closure::BEGIN@2 |
5 | 1 | 400ns | $Eval::Closure::VERSION = '0.13'; | ||
6 | 2 | 12µs | 2 | 6µs | # spent 5µs (4+1) within Eval::Closure::BEGIN@6 which was called:
# once (4µs+1µs) by Class::MOP::Method::Generated::BEGIN@7 at line 6 # spent 5µs making 1 call to Eval::Closure::BEGIN@6
# spent 1µs making 1 call to strict::import |
7 | 2 | 15µs | 2 | 10µs | # spent 7µs (5+2) within Eval::Closure::BEGIN@7 which was called:
# once (5µs+2µs) by Class::MOP::Method::Generated::BEGIN@7 at line 7 # spent 7µs making 1 call to Eval::Closure::BEGIN@7
# spent 2µs making 1 call to warnings::import |
8 | # ABSTRACT: safely and cleanly create closures via string eval | ||||
9 | |||||
10 | 2 | 22µs | 2 | 21µs | # spent 14µs (7+7) within Eval::Closure::BEGIN@10 which was called:
# once (7µs+7µs) by Class::MOP::Method::Generated::BEGIN@7 at line 10 # spent 14µs making 1 call to Eval::Closure::BEGIN@10
# spent 7µs making 1 call to Exporter::import |
11 | 1 | 800ns | @Eval::Closure::EXPORT = @Eval::Closure::EXPORT_OK = 'eval_closure'; | ||
12 | |||||
13 | 2 | 17µs | 2 | 63µs | # spent 34µs (6+28) within Eval::Closure::BEGIN@13 which was called:
# once (6µs+28µs) by Class::MOP::Method::Generated::BEGIN@7 at line 13 # spent 34µs making 1 call to Eval::Closure::BEGIN@13
# spent 28µs making 1 call to Exporter::import |
14 | 2 | 13µs | 1 | 2µs | # spent 2µs within Eval::Closure::BEGIN@14 which was called:
# once (2µs+0s) by Class::MOP::Method::Generated::BEGIN@7 at line 14 # spent 2µs making 1 call to Eval::Closure::BEGIN@14 |
15 | 2 | 12µs | 2 | 32µs | # spent 18µs (4+14) within Eval::Closure::BEGIN@15 which was called:
# once (4µs+14µs) by Class::MOP::Method::Generated::BEGIN@7 at line 15 # spent 18µs making 1 call to Eval::Closure::BEGIN@15
# spent 14µs making 1 call to Exporter::import |
16 | 2 | 18µs | 2 | 37µs | # spent 20µs (4+16) within Eval::Closure::BEGIN@16 which was called:
# once (4µs+16µs) by Class::MOP::Method::Generated::BEGIN@7 at line 16 # spent 20µs making 1 call to Eval::Closure::BEGIN@16
# spent 16µs making 1 call to Exporter::import |
17 | |||||
18 | 2 | 603µs | 2 | 84µs | # spent 45µs (7+38) within Eval::Closure::BEGIN@18 which was called:
# once (7µs+38µs) by Class::MOP::Method::Generated::BEGIN@7 at line 18 # spent 45µs making 1 call to Eval::Closure::BEGIN@18
# spent 38µs making 1 call to constant::import |
19 | |||||
- - | |||||
22 | # spent 31.3ms (9.01+22.3) within Eval::Closure::eval_closure which was called 208 times, avg 150µs/call:
# 131 times (4.39ms+15.8ms) by Class::MOP::Method::Generated::_compile_code at line 56 of Class/MOP/Method/Generated.pm, avg 154µs/call
# 77 times (4.62ms+6.44ms) by Moose::Meta::TypeConstraint::_actually_compile_type_constraint at line 288 of Moose/Meta/TypeConstraint.pm, avg 144µs/call | ||||
23 | 208 | 173µs | my (%args) = @_; | ||
24 | |||||
25 | # default to copying environment | ||||
26 | 208 | 97µs | $args{alias} = 0 if !exists $args{alias}; | ||
27 | |||||
28 | 208 | 188µs | 208 | 646µs | $args{source} = _canonicalize_source($args{source}); # spent 646µs making 208 calls to Eval::Closure::_canonicalize_source, avg 3µs/call |
29 | 208 | 151µs | 208 | 718µs | _validate_env($args{environment} ||= {}); # spent 718µs making 208 calls to Eval::Closure::_validate_env, avg 3µs/call |
30 | |||||
31 | $args{source} = _line_directive(@args{qw(line description)}) | ||||
32 | . $args{source} | ||||
33 | 208 | 132µs | if defined $args{description} && !($^P & 0x10); | ||
34 | |||||
35 | 208 | 223µs | 208 | 20.9ms | my ($code, $e) = _clean_eval_closure(@args{qw(source environment alias)}); # spent 20.9ms making 208 calls to Eval::Closure::_clean_eval_closure, avg 100µs/call |
36 | |||||
37 | 208 | 35µs | if (!$code) { | ||
38 | if ($args{terse_error}) { | ||||
39 | die "$e\n"; | ||||
40 | } | ||||
41 | else { | ||||
42 | croak("Failed to compile source: $e\n\nsource:\n$args{source}") | ||||
43 | } | ||||
44 | } | ||||
45 | |||||
46 | 208 | 358µs | return $code; | ||
47 | } | ||||
48 | |||||
49 | # spent 646µs (601+45) within Eval::Closure::_canonicalize_source which was called 208 times, avg 3µs/call:
# 208 times (601µs+45µs) by Eval::Closure::eval_closure at line 28, avg 3µs/call | ||||
50 | 208 | 41µs | my ($source) = @_; | ||
51 | |||||
52 | 208 | 43µs | if (defined($source)) { | ||
53 | 208 | 51µs | if (ref($source)) { | ||
54 | 131 | 3.91ms | 131 | 45µs | if (reftype($source) eq 'ARRAY' # spent 45µs making 131 calls to Scalar::Util::reftype, avg 347ns/call |
55 | || overload::Method($source, '@{}')) { | ||||
56 | return join "\n", @$source; | ||||
57 | } | ||||
58 | elsif (overload::Method($source, '""')) { | ||||
59 | return "$source"; | ||||
60 | } | ||||
61 | else { | ||||
62 | croak("The 'source' parameter to eval_closure must be a " | ||||
63 | . "string or array reference"); | ||||
64 | } | ||||
65 | } | ||||
66 | else { | ||||
67 | 77 | 104µs | return $source; | ||
68 | } | ||||
69 | } | ||||
70 | else { | ||||
71 | croak("The 'source' parameter to eval_closure is required"); | ||||
72 | } | ||||
73 | } | ||||
74 | |||||
75 | # spent 718µs (597+120) within Eval::Closure::_validate_env which was called 208 times, avg 3µs/call:
# 208 times (597µs+120µs) by Eval::Closure::eval_closure at line 29, avg 3µs/call | ||||
76 | 208 | 35µs | my ($env) = @_; | ||
77 | |||||
78 | 208 | 281µs | 208 | 66µs | croak("The 'environment' parameter must be a hashref") # spent 66µs making 208 calls to Scalar::Util::reftype, avg 316ns/call |
79 | unless reftype($env) eq 'HASH'; | ||||
80 | |||||
81 | 208 | 348µs | for my $var (keys %$env) { | ||
82 | 57 | 10µs | if (HAS_LEXICAL_SUBS) { | ||
83 | 57 | 113µs | 57 | 55µs | croak("Environment key '$var' should start with \@, \%, \$, or \&") # spent 55µs making 57 calls to Eval::Closure::CORE:match, avg 960ns/call |
84 | unless $var =~ /^([\@\%\$\&])/; | ||||
85 | } | ||||
86 | else { | ||||
87 | croak("Environment key '$var' should start with \@, \%, or \$") | ||||
88 | unless $var =~ /^([\@\%\$])/; | ||||
89 | } | ||||
90 | croak("Environment values must be references, not $env->{$var}") | ||||
91 | 57 | 27µs | unless ref($env->{$var}); | ||
92 | } | ||||
93 | } | ||||
94 | |||||
95 | sub _line_directive { | ||||
96 | my ($line, $description) = @_; | ||||
97 | |||||
98 | $line = 1 unless defined($line); | ||||
99 | |||||
100 | return qq{#line $line "$description"\n}; | ||||
101 | } | ||||
102 | |||||
103 | # spent 20.9ms (1.91+19.0) within Eval::Closure::_clean_eval_closure which was called 208 times, avg 100µs/call:
# 208 times (1.91ms+19.0ms) by Eval::Closure::eval_closure at line 35, avg 100µs/call | ||||
104 | 208 | 63µs | my ($source, $captures, $alias) = @_; | ||
105 | |||||
106 | 208 | 357µs | 208 | 69µs | my @capture_keys = sort keys %$captures; # spent 69µs making 208 calls to Eval::Closure::CORE:sort, avg 330ns/call |
107 | |||||
108 | 208 | 61µs | if ($ENV{EVAL_CLOSURE_PRINT_SOURCE}) { | ||
109 | _dump_source(_make_compiler_source($source, $alias, @capture_keys)); | ||||
110 | } | ||||
111 | |||||
112 | 208 | 253µs | 208 | 18.6ms | my ($compiler, $e) = _make_compiler($source, $alias, @capture_keys); # spent 18.6ms making 208 calls to Eval::Closure::_make_compiler, avg 90µs/call |
113 | 208 | 24µs | my $code; | ||
114 | 208 | 291µs | 208 | 295µs | if (defined $compiler) { # spent 5µs making 1 call to Eval::Closure::Sandbox_159::__ANON__[(eval 193)[Eval/Closure.pm:142]:90]
# spent 3µs making 1 call to Eval::Closure::Sandbox_68::__ANON__[(eval 101)[Eval/Closure.pm:142]:100]
# spent 3µs making 1 call to Eval::Closure::Sandbox_154::__ANON__[(eval 188)[Eval/Closure.pm:142]:21]
# spent 3µs making 1 call to Eval::Closure::Sandbox_19::__ANON__[(eval 51)[Eval/Closure.pm:142]:55]
# spent 3µs making 1 call to Eval::Closure::Sandbox_157::__ANON__[(eval 191)[Eval/Closure.pm:142]:23]
# spent 2µs making 1 call to Eval::Closure::Sandbox_151::__ANON__[(eval 185)[Eval/Closure.pm:142]:18]
# spent 2µs making 1 call to Eval::Closure::Sandbox_158::__ANON__[(eval 192)[Eval/Closure.pm:142]:16]
# spent 2µs making 1 call to Eval::Closure::Sandbox_100::__ANON__[(eval 133)[Eval/Closure.pm:142]:139]
# spent 2µs making 1 call to Eval::Closure::Sandbox_117::__ANON__[(eval 150)[Eval/Closure.pm:142]:157]
# spent 2µs making 1 call to Eval::Closure::Sandbox_106::__ANON__[(eval 139)[Eval/Closure.pm:142]:100]
# spent 2µs making 1 call to Eval::Closure::Sandbox_17::__ANON__[(eval 49)[Eval/Closure.pm:142]:49]
# spent 2µs making 1 call to Eval::Closure::Sandbox_74::__ANON__[(eval 107)[Eval/Closure.pm:142]:106]
# spent 2µs making 1 call to Eval::Closure::Sandbox_75::__ANON__[(eval 108)[Eval/Closure.pm:142]:25]
# spent 2µs making 1 call to Eval::Closure::Sandbox_128::__ANON__[(eval 161)[Eval/Closure.pm:142]:31]
# spent 2µs making 1 call to Eval::Closure::Sandbox_34::__ANON__[(eval 66)[Eval/Closure.pm:142]:9]
# spent 2µs making 1 call to Eval::Closure::Sandbox_36::__ANON__[(eval 68)[Eval/Closure.pm:142]:55]
# spent 2µs making 1 call to Eval::Closure::Sandbox_83::__ANON__[(eval 116)[Eval/Closure.pm:142]:40]
# spent 2µs making 1 call to Eval::Closure::Sandbox_84::__ANON__[(eval 117)[Eval/Closure.pm:142]:28]
# spent 2µs making 1 call to Eval::Closure::Sandbox_109::__ANON__[(eval 142)[Eval/Closure.pm:142]:16]
# spent 2µs making 1 call to Eval::Closure::Sandbox_119::__ANON__[(eval 152)[Eval/Closure.pm:142]:9]
# spent 2µs making 1 call to Eval::Closure::Sandbox_125::__ANON__[(eval 158)[Eval/Closure.pm:142]:31]
# spent 2µs making 1 call to Eval::Closure::Sandbox_186::__ANON__[(eval 272)[Eval/Closure.pm:142]:4]
# spent 2µs making 1 call to Eval::Closure::Sandbox_24::__ANON__[(eval 56)[Eval/Closure.pm:142]:55]
# spent 2µs making 1 call to Eval::Closure::Sandbox_33::__ANON__[(eval 65)[Eval/Closure.pm:142]:52]
# spent 2µs making 1 call to Eval::Closure::Sandbox_52::__ANON__[(eval 84)[Eval/Closure.pm:142]:9]
# spent 2µs making 1 call to Eval::Closure::Sandbox_65::__ANON__[(eval 97)[Eval/Closure.pm:142]:11]
# spent 2µs making 1 call to Eval::Closure::Sandbox_81::__ANON__[(eval 114)[Eval/Closure.pm:142]:28]
# spent 2µs making 1 call to Eval::Closure::Sandbox_85::__ANON__[(eval 118)[Eval/Closure.pm:142]:28]
# spent 2µs making 1 call to Eval::Closure::Sandbox_107::__ANON__[(eval 140)[Eval/Closure.pm:142]:28]
# spent 2µs making 1 call to Eval::Closure::Sandbox_111::__ANON__[(eval 144)[Eval/Closure.pm:142]:19]
# spent 2µs making 1 call to Eval::Closure::Sandbox_122::__ANON__[(eval 155)[Eval/Closure.pm:142]:31]
# spent 2µs making 1 call to Eval::Closure::Sandbox_126::__ANON__[(eval 159)[Eval/Closure.pm:142]:25]
# spent 2µs making 1 call to Eval::Closure::Sandbox_160::__ANON__[(eval 194)[Eval/Closure.pm:142]:9]
# spent 2µs making 1 call to Eval::Closure::Sandbox_29::__ANON__[(eval 61)[Eval/Closure.pm:142]:55]
# spent 2µs making 1 call to Eval::Closure::Sandbox_77::__ANON__[(eval 110)[Eval/Closure.pm:142]:11]
# spent 2µs making 1 call to Eval::Closure::Sandbox_79::__ANON__[(eval 112)[Eval/Closure.pm:142]:27]
# spent 2µs making 1 call to Eval::Closure::Sandbox_80::__ANON__[(eval 113)[Eval/Closure.pm:142]:27]
# spent 2µs making 1 call to Eval::Closure::Sandbox_82::__ANON__[(eval 115)[Eval/Closure.pm:142]:46]
# spent 2µs making 1 call to Eval::Closure::Sandbox_31::__ANON__[(eval 63)[Eval/Closure.pm:142]:52]
# spent 2µs making 1 call to Eval::Closure::Sandbox_38::__ANON__[(eval 70)[Eval/Closure.pm:142]:52]
# spent 2µs making 1 call to Eval::Closure::Sandbox_43::__ANON__[(eval 75)[Eval/Closure.pm:142]:22]
# spent 2µs making 1 call to Eval::Closure::Sandbox_57::__ANON__[(eval 89)[Eval/Closure.pm:142]:4]
# spent 2µs making 1 call to Eval::Closure::Sandbox_120::__ANON__[(eval 153)[Eval/Closure.pm:142]:25]
# spent 2µs making 1 call to Eval::Closure::Sandbox_72::__ANON__[(eval 105)[Eval/Closure.pm:142]:9]
# spent 2µs making 1 call to Eval::Closure::Sandbox_88::__ANON__[(eval 121)[Eval/Closure.pm:142]:9]
# spent 2µs making 1 call to Eval::Closure::Sandbox_37::__ANON__[(eval 69)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_108::__ANON__[(eval 141)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_112::__ANON__[(eval 145)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_113::__ANON__[(eval 146)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_114::__ANON__[(eval 147)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_131::__ANON__[(eval 164)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_152::__ANON__[(eval 186)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_173::__ANON__[(eval 238)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_194::__ANON__[(eval 291)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_32::__ANON__[(eval 64)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_51::__ANON__[(eval 83)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_53::__ANON__[(eval 85)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_66::__ANON__[(eval 99)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_69::__ANON__[(eval 102)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_70::__ANON__[(eval 103)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_76::__ANON__[(eval 109)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_87::__ANON__[(eval 120)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_92::__ANON__[(eval 125)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_101::__ANON__[(eval 134)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_102::__ANON__[(eval 135)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_103::__ANON__[(eval 136)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_105::__ANON__[(eval 138)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_118::__ANON__[(eval 151)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_123::__ANON__[(eval 156)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_127::__ANON__[(eval 160)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_132::__ANON__[(eval 165)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_134::__ANON__[(eval 167)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_137::__ANON__[(eval 170)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_142::__ANON__[(eval 175)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_144::__ANON__[(eval 177)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_149::__ANON__[(eval 183)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_150::__ANON__[(eval 184)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_153::__ANON__[(eval 187)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_15::__ANON__[(eval 47)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_161::__ANON__[(eval 220)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_163::__ANON__[(eval 222)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_181::__ANON__[(eval 259)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_189::__ANON__[(eval 275)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_190::__ANON__[(eval 276)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_191::__ANON__[(eval 288)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_192::__ANON__[(eval 289)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_195::__ANON__[(eval 293)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_205::__ANON__[(eval 307)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_206::__ANON__[(eval 308)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_207::__ANON__[(eval 311)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_25::__ANON__[(eval 57)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_30::__ANON__[(eval 62)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_35::__ANON__[(eval 67)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_39::__ANON__[(eval 71)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_86::__ANON__[(eval 119)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_89::__ANON__[(eval 122)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_8::__ANON__[(eval 40)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_91::__ANON__[(eval 124)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_93::__ANON__[(eval 126)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_94::__ANON__[(eval 127)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_95::__ANON__[(eval 128)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_97::__ANON__[(eval 130)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_98::__ANON__[(eval 131)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_9::__ANON__[(eval 41)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_110::__ANON__[(eval 143)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_115::__ANON__[(eval 148)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_11::__ANON__[(eval 43)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_129::__ANON__[(eval 162)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_12::__ANON__[(eval 44)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_133::__ANON__[(eval 166)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_135::__ANON__[(eval 168)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_138::__ANON__[(eval 171)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_139::__ANON__[(eval 172)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_143::__ANON__[(eval 176)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_147::__ANON__[(eval 180)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_14::__ANON__[(eval 46)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_155::__ANON__[(eval 189)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_156::__ANON__[(eval 190)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_165::__ANON__[(eval 228)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_167::__ANON__[(eval 231)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_168::__ANON__[(eval 232)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_169::__ANON__[(eval 233)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_170::__ANON__[(eval 234)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_171::__ANON__[(eval 235)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_174::__ANON__[(eval 239)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_175::__ANON__[(eval 240)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_177::__ANON__[(eval 243)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_182::__ANON__[(eval 260)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_185::__ANON__[(eval 271)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_187::__ANON__[(eval 273)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_188::__ANON__[(eval 274)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_18::__ANON__[(eval 50)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_193::__ANON__[(eval 290)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_1::__ANON__[(eval 33)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_201::__ANON__[(eval 299)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_202::__ANON__[(eval 300)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_204::__ANON__[(eval 303)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_20::__ANON__[(eval 52)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_2::__ANON__[(eval 34)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_44::__ANON__[(eval 76)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_60::__ANON__[(eval 92)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_67::__ANON__[(eval 100)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_73::__ANON__[(eval 106)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_78::__ANON__[(eval 111)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_90::__ANON__[(eval 123)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_96::__ANON__[(eval 129)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_99::__ANON__[(eval 132)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_104::__ANON__[(eval 137)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_10::__ANON__[(eval 42)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_116::__ANON__[(eval 149)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_121::__ANON__[(eval 154)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_124::__ANON__[(eval 157)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_136::__ANON__[(eval 169)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_13::__ANON__[(eval 45)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_140::__ANON__[(eval 173)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_141::__ANON__[(eval 174)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_148::__ANON__[(eval 181)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_162::__ANON__[(eval 221)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_164::__ANON__[(eval 223)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_166::__ANON__[(eval 229)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_172::__ANON__[(eval 236)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_178::__ANON__[(eval 244)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_179::__ANON__[(eval 246)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_180::__ANON__[(eval 247)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_183::__ANON__[(eval 264)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_196::__ANON__[(eval 294)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_197::__ANON__[(eval 295)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_199::__ANON__[(eval 297)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_203::__ANON__[(eval 302)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_208::__ANON__[(eval 312)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_21::__ANON__[(eval 53)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_22::__ANON__[(eval 54)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_23::__ANON__[(eval 55)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_27::__ANON__[(eval 59)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_3::__ANON__[(eval 35)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_40::__ANON__[(eval 72)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_41::__ANON__[(eval 73)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_46::__ANON__[(eval 78)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_4::__ANON__[(eval 36)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_50::__ANON__[(eval 82)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_55::__ANON__[(eval 87)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_56::__ANON__[(eval 88)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_58::__ANON__[(eval 90)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_61::__ANON__[(eval 93)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_71::__ANON__[(eval 104)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_130::__ANON__[(eval 163)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_145::__ANON__[(eval 178)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_146::__ANON__[(eval 179)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_184::__ANON__[(eval 265)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_198::__ANON__[(eval 296)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_200::__ANON__[(eval 298)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_26::__ANON__[(eval 58)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_28::__ANON__[(eval 60)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_42::__ANON__[(eval 74)[Eval/Closure.pm:142]:6]
# spent 1µs making 1 call to Eval::Closure::Sandbox_45::__ANON__[(eval 77)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_48::__ANON__[(eval 80)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_49::__ANON__[(eval 81)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_54::__ANON__[(eval 86)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_59::__ANON__[(eval 91)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_62::__ANON__[(eval 94)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_63::__ANON__[(eval 95)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_64::__ANON__[(eval 96)[Eval/Closure.pm:142]:4]
# spent 1µs making 1 call to Eval::Closure::Sandbox_6::__ANON__[(eval 38)[Eval/Closure.pm:142]:9]
# spent 1µs making 1 call to Eval::Closure::Sandbox_7::__ANON__[(eval 39)[Eval/Closure.pm:142]:6]
# spent 900ns making 1 call to Eval::Closure::Sandbox_16::__ANON__[(eval 48)[Eval/Closure.pm:142]:6]
# spent 900ns making 1 call to Eval::Closure::Sandbox_176::__ANON__[(eval 241)[Eval/Closure.pm:142]:4]
# spent 900ns making 1 call to Eval::Closure::Sandbox_47::__ANON__[(eval 79)[Eval/Closure.pm:142]:4]
# spent 900ns making 1 call to Eval::Closure::Sandbox_5::__ANON__[(eval 37)[Eval/Closure.pm:142]:6] |
115 | $code = $compiler->(@$captures{@capture_keys}); | ||||
116 | } | ||||
117 | |||||
118 | 208 | 144µs | if (defined($code) && (!ref($code) || ref($code) ne 'CODE')) { | ||
119 | $e = "The 'source' parameter must return a subroutine reference, " | ||||
120 | . "not $code"; | ||||
121 | undef $code; | ||||
122 | } | ||||
123 | |||||
124 | 208 | 29µs | if ($alias) { | ||
125 | require Devel::LexAlias; | ||||
126 | Devel::LexAlias::lexalias($code, $_, $captures->{$_}) | ||||
127 | for grep !/^\&/, keys %$captures; | ||||
128 | } | ||||
129 | |||||
130 | 208 | 4.33ms | return ($code, $e); | ||
131 | } | ||||
132 | |||||
133 | # spent 18.6ms (824µs+17.8) within Eval::Closure::_make_compiler which was called 208 times, avg 90µs/call:
# 208 times (824µs+17.8ms) by Eval::Closure::_clean_eval_closure at line 112, avg 90µs/call | ||||
134 | 208 | 170µs | 208 | 736µs | my $source = _make_compiler_source(@_); # spent 736µs making 208 calls to Eval::Closure::_make_compiler_source, avg 4µs/call |
135 | |||||
136 | 208 | 387µs | 208 | 17.1ms | return @{ _clean_eval($source) }; # spent 17.1ms making 208 calls to Eval::Closure::_clean_eval, avg 82µs/call |
137 | } | ||||
138 | |||||
139 | # spent 17.1ms within Eval::Closure::_clean_eval which was called 208 times, avg 82µs/call:
# 208 times (17.1ms+0s) by Eval::Closure::_make_compiler at line 136, avg 82µs/call | ||||
140 | 208 | 36µs | local $@; | ||
141 | 208 | 261µs | local $SIG{__DIE__}; | ||
142 | 208 | 15.7ms | my $compiler = eval $_[0]; # spent 5.24ms executing statements in 208 string evals (merged) # includes 295µs spent executing 208 calls to 419 subs defined therein. | ||
143 | 208 | 50µs | my $e = $@; | ||
144 | 208 | 707µs | [ $compiler, $e ]; | ||
145 | } | ||||
146 | |||||
147 | 1 | 200ns | $Eval::Closure::SANDBOX_ID = 0; | ||
148 | |||||
149 | # spent 736µs (565+171) within Eval::Closure::_make_compiler_source which was called 208 times, avg 4µs/call:
# 208 times (565µs+171µs) by Eval::Closure::_make_compiler at line 134, avg 4µs/call | ||||
150 | 208 | 61µs | my ($source, $alias, @capture_keys) = @_; | ||
151 | 208 | 39µs | $Eval::Closure::SANDBOX_ID++; | ||
152 | 208 | 31µs | my $i = 0; | ||
153 | return join "\n", ( | ||||
154 | "package Eval::Closure::Sandbox_$Eval::Closure::SANDBOX_ID;", | ||||
155 | 'sub {', | ||||
156 | 265 | 507µs | 57 | 171µs | (map { _make_lexical_assignment($_, $i++, $alias) } @capture_keys), # spent 171µs making 57 calls to Eval::Closure::_make_lexical_assignment, avg 3µs/call |
157 | $source, | ||||
158 | '}', | ||||
159 | ); | ||||
160 | } | ||||
161 | |||||
162 | # spent 171µs within Eval::Closure::_make_lexical_assignment which was called 57 times, avg 3µs/call:
# 57 times (171µs+0s) by Eval::Closure::_make_compiler_source at line 156, avg 3µs/call | ||||
163 | 57 | 12µs | my ($key, $index, $alias) = @_; | ||
164 | 57 | 32µs | my $sigil = substr($key, 0, 1); | ||
165 | 57 | 16µs | my $name = substr($key, 1); | ||
166 | 57 | 10µs | if (HAS_LEXICAL_SUBS && $sigil eq '&') { | ||
167 | my $tmpname = '$__' . $name . '__' . $index; | ||||
168 | return 'use feature "lexical_subs"; ' | ||||
169 | . 'no warnings "experimental::lexical_subs"; ' | ||||
170 | . 'my ' . $tmpname . ' = $_[' . $index . ']; ' | ||||
171 | . 'my sub ' . $name . ' { goto ' . $tmpname . ' }'; | ||||
172 | } | ||||
173 | 57 | 9µs | if ($alias) { | ||
174 | return 'my ' . $key . ';'; | ||||
175 | } | ||||
176 | else { | ||||
177 | 57 | 126µs | return 'my ' . $key . ' = ' . $sigil . '{$_[' . $index . ']};'; | ||
178 | } | ||||
179 | } | ||||
180 | |||||
181 | sub _dump_source { | ||||
182 | my ($source) = @_; | ||||
183 | |||||
184 | my $output; | ||||
185 | if (try { require Perl::Tidy }) { | ||||
186 | Perl::Tidy::perltidy( | ||||
187 | source => \$source, | ||||
188 | destination => \$output, | ||||
189 | argv => [], | ||||
190 | ); | ||||
191 | } | ||||
192 | else { | ||||
193 | $output = $source; | ||||
194 | } | ||||
195 | |||||
196 | warn "$output\n"; | ||||
197 | } | ||||
198 | |||||
199 | |||||
200 | 1 | 3µs | 1; | ||
201 | |||||
202 | __END__ | ||||
# spent 55µs within Eval::Closure::CORE:match which was called 57 times, avg 960ns/call:
# 57 times (55µs+0s) by Eval::Closure::_validate_env at line 83, avg 960ns/call | |||||
# spent 69µs within Eval::Closure::CORE:sort which was called 208 times, avg 330ns/call:
# 208 times (69µs+0s) by Eval::Closure::_clean_eval_closure at line 106, avg 330ns/call |