2

I have a x86 cygwin installation(v. (cygwin) 2.3.1 installed yesterday) where practically every tool loads very slowly. grep, tail, less, which, echo, cat -- every utility takes 2 seconds to load and execute even for negligible work load.

How can I improve performance ? How do I troubleshoot ? c:\cygwin\bin; is the 1st entry in the path.

Previously, I had installed a 64 bit version of cygwin and that had the same problem as well. So, I installed a x86 version and see the same problem.

windows : 64 bit of windows 7 enterprise.

If a native application, like GNU emacs and other programs can load faster than grep -h or echo "hi", I'm sure the problem is with cygwin loading. How do I optimize cygwin loading ?

It takes the cygwin prompt 2-3 seconds to load. Inside the cygwin prompt, if I execute any of the cygwin tools, then the startup time is good. However, when I run the cygwin tools from cmd.exe (command prompt), then the response time is slow -- about 2 seconds. How can I eliminate this 2 seconds lag ?

  • all other programs run as per expectation. Only cygwin tools are slow. If I write programs in golang and they execute, they start quite fast. The problem with cygwin tools are that the startup time is very slow, the execution time is OK. Hope that helps. – anjanbacchu Jan 4 '16 at 7:55
  • just to be clear : I wrote a program in golang to print 2 lines to the console. This program runs instantaneously. Whereas the cygwin\bin\grep -h takes about 2 seconds to execute. For reference, n this system, it takes about 1.5 seconds for gnu win32 emacs(GUI) to load! How do I optimize cygwin to load faster – anjanbacchu Jan 5 '16 at 3:38
  • I'm not sure if this will test what I want, but try opening a Cygwin prompt alongside a command prompt and see if the programs still work slowly. I'm thinking it might have to do with the way Cygwin works and the fact it uses a ~5MB DLL and that it might be able to use the already loaded one when executing inside the Cygwin prompt – nijave Jan 5 '16 at 23:37
  • Hi @nijave, I tried that and still find that the tools take their own sweet time outside of the cygwin prompt. – anjanbacchu Jan 6 '16 at 0:24
  • is the computer part of a domain? It appears that could add time to Cygwin tools execution as it might be doing some sort of checks in the background – nijave Jan 7 '16 at 2:34
0
+50

How do I optimize Cygwin loading?

You need to disable Active Directory lookup:

A section in Cygwin's FAQ addresses slow startup times. Cygwin recently changed to using Active Directory lookups for authentication, rather than using flat files. Changing the defaults in /etc/nsswitch.conf from

passwd:   files db
group:    files db

to

passwd:   files
group:    files

skips the AD lookup. My Cygwin commands are now speedy again.

Source Cygwin commands from CMD are slow; from bash are fast answer by tbhartman

  • thanks that worked! I once thought that the logout message at the end of a cygwin bash session might be related to this but didn't know how to investigate further. thanks for pointing out. – anjanbacchu Jan 13 '16 at 8:50
1

I would first start by looking as storage (hard drive/SSD) usage since that is a pretty common bottleneck.

Check Resource Monitor so see how your disk is performing:

  1. Open Resource Monitor (search through the Start Menu)
  2. Go to the Disk tab at the top
  3. In the bottom panel, watch Active Time and Disk Queue length to see if there are spikes while using Cygwin.

If it's an SSD, storage probably isn't the bottleneck. Generally you start to see issues when Disk Queue is > 5. If you have a slower "green" or 5400 rpm laptop hard drive, you may want to try running a defrag since Cygwin installs quite a few very small files.

If all of the above check out and you're still seeing issues, you should take a look at a program like Process Monitor which will show you what actions (file reads/writes, registry reads/writes) a program is executing and that should help you determine what is causing the slowdowns. In addition, you should test doing something like "grep -h" to see how quickly it loads. If the results are quick, it's possible you just have a slow or failing hard drive which is causing significant overhead.

For me, the Cygwin prompt takes a few seconds to open but the programs are all at least as fast Windows equivalents and other cli programs.

  • grep -h takes 4 seconds for 2 line output. Even echo "hi" takes 4 seconds. Something is wrong with initialization/loading. Execution time is OK once startup has occurred. – anjanbacchu Jan 4 '16 at 7:57
  • "For me, the Cygwin prompt takes a few seconds to open but the programs are all at least as fast Windows equivalents and other cli programs." ---------- Yes, for me also cygwin prompt takes 2-3 seconds. If I execute any of the cygwin tools, then the startup time is good. However, when I run the cygwin tools from cmd.exe (command prompt), then the response time is slow -- about 2 seconds. How can I eliminate this 2 seconds lag ? – anjanbacchu Jan 5 '16 at 3:55
  • added a bounty! – anjanbacchu Jan 6 '16 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.