git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David Symonds" <dsymonds@gmail.com>
To: "John Chapman" <thestar@fussycoder.id.au>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] Cached the git configuration, which is now noticibly faster on windows.
Date: Fri, 7 Nov 2008 21:19:49 -0800	[thread overview]
Message-ID: <ee77f5c20811072119y65738f54o7e6792fb405c142c@mail.gmail.com> (raw)
In-Reply-To: <1226114569-8506-2-git-send-email-thestar@fussycoder.id.au>

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)



Dave.

  reply	other threads:[~2008-11-08  5:21 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 [this message]
2008-11-08  6:52     ` Arafangion
2008-11-10  8:38       ` Steve Frécinaux
2008-11-08 10:13     ` Jakub Narebski
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=ee77f5c20811072119y65738f54o7e6792fb405c142c@mail.gmail.com \
    --to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).