Search code examples
bashcygwin

Why does Cygwin execute shell commands very slowly?


Just tests a very simple command like:

while true; do bash -c "echo hello"; done

You will find how much slow the bash in Cygwin is. Does anybody know why?

It's a fresh install of cygwin 1.7 on win7.

thanks to Jared's testing idea, I modified the command to this(adds bash -c):

time for i in {1..10} ; do bash -c "echo Hello" ; done
Hello
...
real 0m7.711s //it's the problem
user 0m0.091s
sys 0m0.476s

Solution

  • Finally, I found the source - a service named "QQPCMgr RTP Service" running on my office computer, it's the real time protection service of "QQ PC Manager".

    By disabling it, the time of the script in the question falls back to:

    real    0m0.943s
    user    0m0.105s
    sys     0m0.231s
    

    I have told the developers of QQPCMgr about this, hope they will find the reason.

    This still much slower than Linux, but gets the same "real time" of other cygwin computers.

    Thank you all!