EDIT: Oh, I'd skipped the part above "here's how it works"... that just says exactly the same thing I said above.
I believe I had trouble executing any instructions in the new process at all. If you can make it work I'd like to see your code, otherwise I'm skeptical.
Anyways the cygwin guys claim to have forked processes with ZwCreateProcess, but just had problems with getting it to work with the win32 subsystem: http://www.cygwin.com/ml/cygwin-developers/2011-04/msg00034....
Also this guy seems to have managed to do it: http://stackoverflow.com/questions/10657699/cant-use-createp..., but it hang when he called a win32 function (CreateProcess) from the child.
Keep in mind that the whole _point_ of Cygwin is to interact with the Windows world. If you want a POSIX sandbox, you can use a VM with fewer headaches and better performance.
For me, Cygwin has always been pretty much native-speed, its only an API translation layer.
Keep in mind that in addition to the build steps, it's common to break out to sed, grep, and shell to get basic string operations done due to extremely limited capability of make itself. On cygwin, this is slow for large projects.
Cygwin's forking is also temperamental.
https://cygwin.com/cygwin-ug-net/highlights.html#ov-hi-proce...
"In summary, current Windows implementations make it impossible to implement a perfectly reliable fork, and occasional fork failures are inevitable."
I wonder how the authors of midipix propose to resolve the listed issues.
One way to really see the latter is to try to create a git clone using the --reference option against a repo on a mapped drive; msysgit using the drive letter is OK, but cygwin git against the same repo via /cygdrive/mapped is very slow.
Edit: by 'everything that works' I mean everything that interacts with the terminal in a standard way. There are some command line utilities which output to the terminal some way other than stdout, making them very difficult to use in cygwin.
Running scripts?
Also, try enumerating the files in a large directory hierarchy and compare it with native Windows speed (or Linux speed), it's not even comparable.
Personally tho, speed has always been sufficient for me to never notice. I use it most days, but I don't do comparisons.
It's not a question of a 40% speed difference, more like a > 400% speed difference last time I checked.
Here's how it works:
Parent initializes a space in the Cygwin process table for child. Parent creates child suspended using Win32 CreateProcess call, giving the same path it was invoked with itself. Parent calls setjmp to save its own context and then sets a pointer to this in the Cygwin shared memory area (shared among all Cygwin tasks). Parent fills in the child's .data and .bss subsections by copying from its own address space into the suspended child's address space. Parent then starts the child. Parent waits on mutex for child to get to safe point. Child starts and discovers if has been forked and then longjumps using the saved jump buffer. Child sets mutex parent is waiting on and then blocks on another mutex waiting for parent to fill in its stack and heap. Parent notices child is in safe area, copies stack and heap from itself into child, releases the mutex the child is waiting on and returns from the fork call. Child wakes from blocking on mutex, recreates any mmapped areas passed to it via shared area and then returns from fork itself.