mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-23 05:07:54 +00:00
parallel: Replacement of many replacementstring is now faster
This commit is contained in:
parent
4f8b5026ec
commit
43788cb720
13
src/parallel
13
src/parallel
|
@ -3621,14 +3621,15 @@ sub number_of_replacements {
|
||||||
'|'.
|
'|'.
|
||||||
join("|",map {$a=$_;$a=~s/(\W)/\\$1/g; $a} values %Global::replace).
|
join("|",map {$a=$_;$a=~s/(\W)/\\$1/g; $a} values %Global::replace).
|
||||||
")";
|
")";
|
||||||
while($cmd =~ s/($replacement_regexp)/\0/o) {
|
my %c = ();
|
||||||
# substitute with \0 to avoid {{}} being interpreted as two {}'s
|
$cmd =~ s/($replacement_regexp)/$c{$1}++;""/ogex;
|
||||||
if(defined $Global::replace_rev{$1}) {
|
for my $k (keys %c) {
|
||||||
$count{$Global::replace_rev{$1}}++;
|
if(defined $Global::replace_rev{$k}) {
|
||||||
|
$count{$Global::replace_rev{$k}} = $c{$k};
|
||||||
} else {
|
} else {
|
||||||
$count{$1}++;
|
$count{$k} = $c{$k};
|
||||||
}
|
}
|
||||||
$sum++;
|
$sum += $c{$k};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $number_of_context_groups = 0;
|
my $number_of_context_groups = 0;
|
||||||
|
|
Loading…
Reference in a new issue