Cygwin fork performance followup
Thu Feb 4 14:44:30 GMT 2021
On 2/4/2021 9:29 AM, Hamish McIntyre-Bhatty via Cygwin wrote:
> Hi all,
> I managed to improve my Cygwin VM's performance significantly using a
> variety of methods.
> If anyone else is experiencing troubles, seeing what I changed at
> https://www.hamishmb.com/blog/improving-cygwins-performance-fork/ might
> also help you. Not using VirtualBox was the main improvement for me (now
> using KVM/QEMU). Note that I didn't achieve much difference, but that
> was because my system is relatively powerful. What isn't shown is that
> these changes do seem to help with the fork speed drop-off that occurs
> over time.
Yes, fork can be a bottleneck in Cygwin. I do wonder if we might get some
improvement for a lot of common cases if spawn were used more, in favor of
fork, and Cygwin supported "fast paths" for the simpler cases of spawn, to
where the libraries in the child process would not need to be loaded in the
same place. More complex cases of spawn could fall back to a fork-based
approach underneath. The idea is to grab some low hanging fruit - if there is
any. What I don't know is whether such fruit can be had. For example, does
bash use spawn, and if so, does it use calls that could be optimized in this
way? I don't know. Likewise other tools that do lost of forking might need
to be inspected, such as 'make'.
I seem to recall this was discussed some before ...
Best wishes - Eliot
More information about the Cygwin