From 99d3f175072a8ef062ba6335a3ceb267ba89c12b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 24 Jan 2021 22:41:57 -0800 Subject: [PATCH] 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. --- lib/PublicInbox/Spawn.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.44.0