diff options
author | Eric Wong <e@80x24.org> | 2023-02-22 17:25:55 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-02-22 21:36:19 +0000 |
commit | f2bb17a54f42a276b993b7dd49c06239141eafe4 (patch) | |
tree | e3a69912bea60446d36be27cd295dbaa9fb20639 /lib/PublicInbox/TestCommon.pm | |
parent | cd73e06277ae9286e9a823b591ca5187ce35cdca (diff) | |
download | public-inbox-f2bb17a54f42a276b993b7dd49c06239141eafe4.tar.gz |
File::Path already accounts for the existence of directories, handles races from redundant mkdir(2), and croaks on unrecoverable errors. So there's no point in doing any of that on our end. Furthermore, avoiding the overhead of loading File::Path doesn't seem worth it to save 20-60ms given the overhead of loading our other code. Instead, try to reduce optree overhead on our code, instead, since File::Path gets used in a bunch of places. We'll also favor the newer make_path for multi-directory invocations to avoid bloating our own optree to create an arrayref, but mkpath is one fewer subroutine call within File::Path itself, right now.
Diffstat (limited to 'lib/PublicInbox/TestCommon.pm')
-rw-r--r-- | lib/PublicInbox/TestCommon.pm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 8a34e45a..fe7af452 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -607,7 +607,7 @@ SKIP: { $lei_opt = { 1 => \$lei_out, 2 => \$lei_err }; my ($daemon_pid, $for_destroy, $daemon_xrd); my $tmpdir = $test_opt->{tmpdir}; - File::Path::mkpath($tmpdir) if (defined $tmpdir && !-d $tmpdir); + File::Path::mkpath($tmpdir) if defined $tmpdir; ($tmpdir, $for_destroy) = tmpdir unless $tmpdir; state $persist_xrd = $ENV{TEST_LEI_DAEMON_PERSIST_DIR}; SKIP: { |