facebookarchive / nailgun

Nailgun is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead.
https://github.com/facebook/nailgun
Other
731 stars 138 forks source link

No busy looping in select on Windows #198

Closed xavierd closed 3 years ago

xavierd commented 3 years ago

On Windows, the PeekNamedPipe will as expected immediately return, but this has the negative side effect of making the select function a busy loop, effectively using a full core. In the case of buck, this ultimately causes compiling to be slower than they should be.

As a workaround, let's just sleep a bit in select if nothing can be read from the named pipe.

nataliejameson commented 3 years ago

Awesome, thanks for the fix!