delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/04/09/17:22:05

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:references
:mime-version:content-type:in-reply-to; q=dns; s=default; b=iRDi
aQ9v+r4e35H2mBdabyEY5bEOOHU6s5xiagZ0dmFbbAK5q78aWiegyFjDzfb2c5j8
riw79EQUVy+soWYIw29JvC9j3q6wdv93QSNpNSK1UBjjkSBJaacsUTpgF7A/yAkt
6QtlFEiFl8zBx6eGsstNlfdLkhg8IA+mehdg/fo=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:references
:mime-version:content-type:in-reply-to; s=default; bh=XbeVA2jfDo
kZ7TLkBEHn8CqGjA4=; b=RRLZQy1vMakPGdU7sT5YlEhfMq58k9IKvtl5TlauHd
CAaQpMEcu9t0oX9j4m9sYJTG3ELBIY2SdkYIz7e4wOvqqvoWTD9/uWPJXeIuavXA
UOGBvo8z7XXT6jfQIZSs/gGZPelKwdx25dYtMUFN5kK46jAFzvud1P4YP2m42sTt
U=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.1
Date: Tue, 9 Apr 2013 14:21:05 -0700
From: Gary Johnson <garyjohn AT spocom DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: bash-completion load times
Message-ID: <20130409212105.GA8645@phoenix>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CE9C056E12502146A72FD81290379E9A6093A204 AT ENFIRHMBX1 DOT datcon DOT co DOT uk>
MIME-Version: 1.0
In-Reply-To: <CE9C056E12502146A72FD81290379E9A6093A204@ENFIRHMBX1.datcon.co.uk>
User-Agent: Mutt/1.5.20 (2009-06-14)

On 2013-03-27, Adam Dinwoodie wrote:
> Having bash-completion installed significantly slows down starting a new Cygwin
> Bash login shell.  It's a problem I've noticed, and I've seen other users
> report it on this list and elsewhere, too.  I've done a bit of digging into
> what the problem is, and what can be done about it-suggestions are at the
> bottom of this email.
> 
> The slow-down from using bash-completion is due to loading the contents of the
> /etc/bash_completion.d/ directory.  By adding `time` statements at various
> ponits in /etc/bash_completion, I can see it's adding a fairly consistent 6-6.5
> seconds to the shell startup time for me, which more-or-less matches my
> subjective experience (starting Bash without bash-completion installed is
> near-instant).
> 
> Drilling down, there are 187 different scripts in my /etc/bash_completion.d
> (which, until today, should have been untouched by anything other than Cygwin
> setup.exe).  Average load times for me vary from less than a millisecond to
> over 600 milliseconds.  I've attached my analysis as a CSV; times are as
> reported by Bash's `time` builtin for the time for /etc/bash_completion to dot
> in that script.
> 
> A lot of the scripts are for things I don't have installed.  The top four
> scripts in terms of time taken (mailman, shadow, dsniff, e2fsprogs) do nothing
> on my system, but between them alone add 1.5 seconds to the average Bash load
> time.  The top 4 seconds includes only two scripts I'm interested in (git and
> gdb).
> 
> On my PC, I've renamed the majority of the scripts in /etc/bash_completion.d to
> have a .bak extension, which prevents bash-completion from loading them.  I've
> kept 37 hand-selected scripts which I either do use or could forsee me using.
> I'm now seeing Bash take less than a second to load, with picking up all the
> scripts taking about 0.3 seconds.
> 
> To avoid others suffering in the same way, I can think of a few different
> options, none of which are ideal:
> 
> -   Add something to the Cygwin FAQ detailing a solution similar to the above.
>     Requires users to actively look for a solution, but requires minimal
>     effort.  If people think this would be useful, I'm happy to draft something
>     up.
> 
> -   Customize Cygwin's bash-completion package, removing scripts for functions
>     that don't exist in Cygwin.  This is obviously additional work for the
>     package maintainer (although I'd be glad to help).  This won't help for
>     packages that could be installed but aren't, however, but it's at least a
>     step.
> 
> -   Split out the bash-completion script into separate packages that users can
>     install as needed.  I suspect this is far more effort than it's worth,
>     however, both for users and maintainers.
> 
> -   Something else yet to be suggested.

Cygwin's bash-completion package is version 1.3.  Versions 1.9 and
later use dynamic loading of completions that is supposed to
improve the loading times.  I think your best bet is to wait for the
Cygwin package to be updated to the latest 2.1 version and see how
that improves performance.  Or just download and install it from
source yourself.

That said, I'm surprised by the variation in load times of the files
in /etc/bash_completion.d that you observed.  Those files all start
with a call to the have() function which should abort further
processing of the file if the corresponding program is not
installed.

Regards,
Gary


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019