← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/Regexp/Common/delimited.pm
StatementsExecuted 12 statements in 222µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1118µs29µsRegexp::Common::delimited::::BEGIN@3Regexp::Common::delimited::BEGIN@3
1114µs6µsRegexp::Common::delimited::::BEGIN@5Regexp::Common::delimited::BEGIN@5
1114µs15µsRegexp::Common::delimited::::BEGIN@8Regexp::Common::delimited::BEGIN@8
1114µs7µsRegexp::Common::delimited::::BEGIN@6Regexp::Common::delimited::BEGIN@6
0000s0sRegexp::Common::delimited::::__ANON__[:49]Regexp::Common::delimited::__ANON__[:49]
0000s0sRegexp::Common::delimited::::__ANON__[:55]Regexp::Common::delimited::__ANON__[:55]
0000s0sRegexp::Common::delimited::::_croakRegexp::Common::delimited::_croak
0000s0sRegexp::Common::delimited::::gen_delimitedRegexp::Common::delimited::gen_delimited
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Regexp::Common::delimited;
2
3217µs229µs
# spent 29µs (8+21) within Regexp::Common::delimited::BEGIN@3 which was called: # once (8µs+21µs) by Regexp::Common::import at line 3
use Regexp::Common qw /pattern clean no_defaults/;
# spent 29µs making 1 call to Regexp::Common::delimited::BEGIN@3 # spent 21µs making 1 call to Regexp::Common::import, recursion: max depth 1, sum of overlapping time 21µs
4
5212µs27µs
# spent 6µs (4+1) within Regexp::Common::delimited::BEGIN@5 which was called: # once (4µs+1µs) by Regexp::Common::import at line 5
use strict;
# spent 6µs making 1 call to Regexp::Common::delimited::BEGIN@5 # spent 1µs making 1 call to strict::import
6213µs210µs
# spent 7µs (4+3) within Regexp::Common::delimited::BEGIN@6 which was called: # once (4µs+3µs) by Regexp::Common::import at line 6
use warnings;
# spent 7µs making 1 call to Regexp::Common::delimited::BEGIN@6 # spent 3µs making 1 call to warnings::import
7
82173µs226µs
# spent 15µs (4+11) within Regexp::Common::delimited::BEGIN@8 which was called: # once (4µs+11µs) by Regexp::Common::import at line 8
use vars qw /$VERSION/;
# spent 15µs making 1 call to Regexp::Common::delimited::BEGIN@8 # spent 11µs making 1 call to vars::import
91300ns$VERSION = '2010010201';
10
11sub gen_delimited {
12
13 my ($dels, $escs) = @_;
14 # return '(?:\S*)' unless $dels =~ /\S/;
15 if (length $escs) {
16 $escs .= substr ($escs, -1) x (length ($dels) - length ($escs));
17 }
18 my @pat = ();
19 my $i;
20 for ($i=0; $i < length $dels; $i++) {
21 my $del = quotemeta substr ($dels, $i, 1);
22 my $esc = length($escs) ? quotemeta substr ($escs, $i, 1) : "";
23 if ($del eq $esc) {
24 push @pat,
25 "(?k:$del)(?k:[^$del]*(?:(?:$del$del)[^$del]*)*)(?k:$del)";
26 }
27 elsif (length $esc) {
28 push @pat,
29 "(?k:$del)(?k:[^$esc$del]*(?:$esc.[^$esc$del]*)*)(?k:$del)";
30 }
31 else {
32 push @pat, "(?k:$del)(?k:[^$del]*)(?k:$del)";
33 }
34 }
35 my $pat = join '|', @pat;
36 return "(?k:$pat)";
37}
38
39sub _croak {
40 require Carp;
41 goto &Carp::croak;
42}
43
44pattern name => [qw( delimited -delim= -esc=\\ )],
45 create => sub {my $flags = $_[1];
46 _croak 'Must specify delimiter in $RE{delimited}'
47 unless length $flags->{-delim};
48 return gen_delimited (@{$flags}{-delim, -esc});
49 },
5013µs148µs ;
# spent 48µs making 1 call to Regexp::Common::pattern
51
52pattern name => [qw( quoted -esc=\\ )],
53 create => sub {my $flags = $_[1];
54 return gen_delimited (q{"'`}, $flags -> {-esc});
55 },
5611µs118µs ;
# spent 18µs making 1 call to Regexp::Common::pattern
57
58
5913µs1;
60
61__END__