From: Eric Wong Date: Mon, 25 Jan 2021 06:41:57 +0000 (-0800) Subject: spawn: split() on regexp, not a literal string X-Git-Tag: v1.7.0~1290 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=99d3f175072a8ef062ba6335a3ceb267ba89c12b;p=public-inbox.git spawn: split() on regexp, not a literal string It doesn't appear Perl (as of 5.32.x) has any internal optimization for splitting on a single-byte, so give it a regexp instead of letting it compile and discard a new one every single time. --- diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index 376d2190..86f66605 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -343,7 +343,7 @@ undef $fdpass; sub which ($) { my ($file) = @_; return $file if index($file, '/') >= 0; - foreach my $p (split(':', $ENV{PATH})) { + for my $p (split(/:/, $ENV{PATH})) { $p .= "/$file"; return $p if -x $p; }