From 7c73a09c6df674e389fb20fb57f63c6bb9695d31 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 3 Jan 2021 20:58:29 +0000 Subject: lei: prefer IO::FDPass over our Inline::C recv_3fds While our recv_3fds() implementation is more efficient syscall-wise, loading Inline takes nearly 50ms on my machine even after Inline::C memoizes the build. The current ~20ms in the fast path is barely acceptable to me, and 50ms would be unusable. Eventually, script/lei may invoke tcc(1) or cc(1) directly in the fast path, but it needs @INC for the slow path, at least. We'll encode the number of FDs into the socket name allow parallel installations, for now. --- t/lei.t | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/lei.t b/t/lei.t index 42c0eb8f..5afb8351 100644 --- a/t/lei.t +++ b/t/lei.t @@ -193,12 +193,14 @@ if ($ENV{TEST_LEI_ONESHOT}) { SKIP: { # real socket require_mods(qw(Cwd), my $nr = 46); - require PublicInbox::Spawn; - skip "Inline::C not installed/configured or IO::FDPass missing", $nr - unless PublicInbox::Spawn->can('send_3fds'); + my $nfd = eval { require IO::FDPass; 1 } // do { + require PublicInbox::Spawn; + PublicInbox::Spawn->can('send_3fds') ? 3 : undef; + } // + skip 'IO::FDPass missing or Inline::C not installed/configured', $nr; local $ENV{XDG_RUNTIME_DIR} = "$home/xdg_run"; - my $sock = "$ENV{XDG_RUNTIME_DIR}/lei/sock"; + my $sock = "$ENV{XDG_RUNTIME_DIR}/lei/$nfd.sock"; ok($lei->('daemon-pid'), 'daemon-pid'); is($err, '', 'no error from daemon-pid'); -- cgit v1.2.3-24-ge0c7