All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "David Symonds" <dsymonds@gmail.com>
Cc: "John Chapman" <thestar@fussycoder.id.au>, git@vger.kernel.org
Subject: Re: [PATCH 2/2] Cached the git configuration, which is now noticibly faster on windows.
Date: Sat, 08 Nov 2008 02:13:32 -0800 (PST)	[thread overview]
Message-ID: <m3mygaeda0.fsf@localhost.localdomain> (raw)
In-Reply-To: <ee77f5c20811072119y65738f54o7e6792fb405c142c@mail.gmail.com>

"David Symonds" <dsymonds@gmail.com> writes:

> On Fri, Nov 7, 2008 at 7:22 PM, John Chapman <thestar@fussycoder.id.au> wrote:
> 
> > +_gitConfig = {}
> >  def gitConfig(key):
> > -    return read_pipe("git config %s" % key, ignore_error=True).strip()
> > +    if not _gitConfig.has_key(key):
> > +        _gitConfig[key] = read_pipe("git config %s" % key, ignore_error=True).strip()
> > +    return _gitConfig[key]
> 
> If this is truly a noticeable bottleneck on Windows, something like
> the following might be even better:  (completely untested!)
> 
> _gitConfig = None
> def gitConfig(key):
>   if _gitConfig is None:
>     lines = read_pipe("git config -l", ignore_error=True).readlines():
>     _gitConfig = dict([l.strip().split('=', 1) for l in lines])
>   return _gitConfig.get(key, None)

Wouldn't it be better to use "git config -l -z", split lines at "\0"
(NUL), and split key from value at first "\N" (CR)? This format was
meant for scripts.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

  parent reply	other threads:[~2008-11-08 10:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-08  3:22 [PATCH 1/2] Added support for purged files and also optimised memory usage John Chapman
2008-11-08  3:22 ` [PATCH 2/2] Cached the git configuration, which is now noticibly faster on windows John Chapman
2008-11-08  5:19   ` David Symonds
2008-11-08  6:52     ` Arafangion
2008-11-10  8:38       ` Steve Frécinaux
2008-11-08 10:13     ` Jakub Narebski [this message]
2008-11-09 18:33   ` Junio C Hamano
2008-11-10  3:50     ` Han-Wen Nienhuys
2008-11-10  9:46     ` Simon Hausmann
2008-11-12  0:50       ` Junio C Hamano
2008-11-12 11:54         ` Arafangion

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3mygaeda0.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=dsymonds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=thestar@fussycoder.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.