I have spent an inordinate time trying to figure out this conundrum. I have already ruled out the usual suspects when it comes to Cygwin slowness. I have two different installations of Cygwin with wildly different performances. This is quantified below as 'fork performance' as well as time to do a git difftool
operation.
Can someone please suggest what I should look at next? The fast cygwin installation is very usable, but I need some up-to-date packages now and any attempts to install, for example, python 3.x results in the whole installation being upgraded (and consequently slowed down :( ).
Summary of performance difference
+---------------------------+----------------+-----------------+----------------------+
| Desc | Version1(Fast) | Version2(Slow) | Git Bash for Windows |
+---------------------------+----------------+-----------------+----------------------+
| git difftool (System CPU) | 15% | 69% | |
| git difftool (Total Time) | 3.284s | 10.549s | 0.46s |
| fork performance | ~15 | ~10 | ~22 (!!) |
+---------------------------+----------------+-----------------+----------------------+
Description of Cygwin installations being compared
Version 1 (referred to as 'V1' below): This is the Babun Cygwin v 1.2.0 (latest stable version). Note that babun itself has been abandoned so this version of Cygwin (64 bit) is quite dated.
Version 2 (referred to as 'V2' below): This has been a number of different things:
- V1 upgraded to the latest using cygwin setup.exe
- A fresh install of Babun v 1.2.0 (yes, same as V1 !!)
- A fresh install of cygwin 64-bit
- A fresh install of Babun nightly (from http://40.114.204.90, I don't have the fork of Babun handy from which this is created)
Usual suspects ruled out
The problem is Version1 is at least 3 times faster for a git operation and has almost 50% faster fork performance than Version2 on the same machine. I have looked at 'Slow Cygwin' posts on SO and elsewhere, literally anything that I could find. This includes:
- Ruled out any BLODA software (have looked at the BLODA list and also tried opening cygwin with
CYGWIN=detect_bloda
which does not reveal any surprises. Very early on this revealed ConEmuHK injection as a problem, which I have since disabled to no avail. Additionally to rule out anything similar all of the following tests were done using the core shell executable (zsh.exe) or using mintty.exe without any wrappers on top like Conemu. - Used strace to compare the DLLs being loaded by V1 and V2. Obviously, the cygwin specific DLLs are different, but the list of non-Cygwin DLLs is identical.
- I have also tried copying the Cygwin DLLs, in chunks, from V1 (fast) -> V2 (slow), doing a rebaseall after each copy operation.
- I have also tried to find out if there is something specific that Babun does while creating the portable Cygwin installation
My PATH is minimal. Nothing on path that's a network share
/usr/local/bin /usr/local/sbin /usr/bin /cygdrive/c/WINDOWS/system32 /cygdrive/c/WINDOWS /cygdrive/c/WINDOWS/System32/Wbem```
Ruled out LDAP issues by creating static
/etc/passwd
and/etc/group
and configured/etc/nsswitch.conf
like so:
Detailed Performance stats
Details of performance difference follow.
Version 1 - Performance
? babun --version
babun version 1.2.0
Created and maintained by Tom Bujok (@tombujok)
Copyright (c) 2014-2015.
~
? while (true); do date --utc; done | uniq -c
11 Tue, Apr 16, 2019 8:16:43 AM
13 Tue, Apr 16, 2019 8:16:44 AM
13 Tue, Apr 16, 2019 8:16:45 AM
14 Tue, Apr 16, 2019 8:16:46 AM
14 Tue, Apr 16, 2019 8:16:47 AM
15 Tue, Apr 16, 2019 8:16:48 AM
14 Tue, Apr 16, 2019 8:16:49 AM
13 Tue, Apr 16, 2019 8:16:50 AM
14 Tue, Apr 16, 2019 8:16:51 AM
13 Tue, Apr 16, 2019 8:16:52 AM
13 Tue, Apr 16, 2019 8:16:53 AM
12 Tue, Apr 16, 2019 8:16:54 AM
14 Tue, Apr 16, 2019 8:16:55 AM
13 Tue, Apr 16, 2019 8:16:56 AM
14 Tue, Apr 16, 2019 8:16:57 AM
❯ time git -C ~/some-git-repo difftool "HEAD~^\!"
0.10s user 0.40s system 15% cpu 3.284 total
Version 2 - Performance
Latest Cygwin 64 bit as of this post
❯ time git -C ~/some-git-repo difftool "HEAD~^\!"
0.14s user 7.17s system 69% cpu 10.549 total
? while (true); do date --utc; done | uniq -c
4 Tue, Apr 16, 2019 8:21:25 AM
10 Tue, Apr 16, 2019 8:21:26 AM
9 Tue, Apr 16, 2019 8:21:27 AM
10 Tue, Apr 16, 2019 8:21:28 AM
10 Tue, Apr 16, 2019 8:21:29 AM
10 Tue, Apr 16, 2019 8:21:30 AM
10 Tue, Apr 16, 2019 8:21:31 AM
10 Tue, Apr 16, 2019 8:21:32 AM
10 Tue, Apr 16, 2019 8:21:33 AM
10 Tue, Apr 16, 2019 8:21:34 AM
9 Tue, Apr 16, 2019 8:21:35 AM
10 Tue, Apr 16, 2019 8:21:36 AM