On Wed, Aug 30, 2023 at 09:48:42AM +1200, Thomas Munro wrote: > On Wed, Aug 30, 2023 at 1:49 AM Noah Misch <n...@leadboat.com> wrote: > > On Tue, Aug 29, 2023 at 04:25:24PM +1200, Thomas Munro wrote: > > > On Tue, Aug 29, 2023 at 1:48 PM Noah Misch <n...@leadboat.com> wrote: > > > > https://github.com/cpan-authors/IPC-Run/issues/166#issuecomment-1288190929 > > > > > > Interesting. But that shows a case with no pipes connected, using > > > select() as a dumb sleep and ignoring SIGCHLD. In our usage we have > > > pipes connected, and I think select() should return when the child's > > > output pipes become readable due to EOF. I guess something about that > > > might be b0rked on Windows? I see there is an extra helper process > > > doing socket<->pipe conversion (hah, that explains an extra ~10ms at > > > the start in my timestamps)... > > > > In that case, let's assume it's not the same issue. > > Yeah, I think it amounts to the same thing, if EOF never arrives. > > I suspect that we could get ->safe_psql() down to about ~25ms baseline > if someone could fix the posited IPC::Run EOF bug
I pushed optimizations in https://github.com/cpan-authors/IPC-Run/pull/172 that make the TAP portion of "make check-world" 7% faster on my GNU/Linux machine. I didn't confirm an EOF bug, but that change also reduces Windows idle time in simple tests. I didn't run Windows check-world with it. For non-Windows, we can get almost all the benefit from the attached one-liner. (The relative benefit is probably lower for parallel check-world, where idle threads matter less, and for slower machines.)
Author: Noah Misch <n...@leadboat.com> Commit: Noah Misch <n...@leadboat.com> Backport IPC::Run optimization to src/test/perl. This one-liner makes the TAP portion of "make check-world" 7% faster on a non-Windows machine. Reviewed by FIXME. Discussion: https://postgr.es/m/FIXME diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 42d5a50..6f7a48b 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -189,6 +189,10 @@ Set to true when running under MSYS2. INIT { + # See https://github.com/cpan-authors/IPC-Run/commit/fc9288c for how this + # reduces idle time. Remove this when IPC::Run 20231003.0 is too old to + # matter (when all versions that matter provide the optimization). + $SIG{CHLD} = sub { }; # Return EPIPE instead of killing the process with SIGPIPE. An affected # test may still fail, but it's more likely to report useful facts.