From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Junio C Hamano <gitster@pobox.com>
Cc: Tanay Abhra <tanayabh@gmail.com>,
git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: [PATCH v7 1/2] add `config_set` API for caching config-like files
Date: Thu, 10 Jul 2014 11:41:38 +0200 [thread overview]
Message-ID: <vpqa98hwnxp.fsf@anie.imag.fr> (raw)
In-Reply-To: <xmqq38ea77gt.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Wed, 09 Jul 2014 10:44:18 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> After thinking about it a bit more, I think <file, line> support
> needs to be done not as a mere client of the generic, uncached
> git_config() API that we have had for forever, like the current
> iteration, but needs to know a bit more about the state the caller
> of the callback (namely, git_parse_source()), and we obviously do
> not want to expose that machinery to anybody other than the
> implementation of the config subsystem (to which the new facility
> this GSoC project adds belongs to), so in that sense you have to
> have your code in the same config.c file anyway.
I do not buy the argument. Why would callers of the callback-style API
not be allowed to give <file, line> errors?
To me, it is a weakness of the API that <file, line> information is not
available to callback functions, regardless of the config-cache.
> It is somewhat dissapointing that this initial implementation was
> done as a client of the traditional git_config(), by the way. I
> would have expected that it would be the other way around, in that
> the traditional callers of git_config() would behefit automatically
> by having the cache layer below it.
I disagree, and I agree ;-).
I disagree that it is disapointing to use git_config(), and I think the
beauty of the current implementation is to allow this cache mechanism
without changing the parsing code.
I agree that the callers of git_config() could benefit from the cache
mechanism, i.e. use the in-memory pre-parsed config instead of
re-parsing the file each time.
> But we have to start from somewhere. Perhaps the round after this
> one can rename the exisiting implementation of git_config() to
> something else internal to the caching layer and give the existing
> callers a compatible interface that is backed by this new caching
> layer in a transparent way.
In PATCH v4, there was a git_config_iter function that did exactly that.
I didn't notice it was gone for v5, but could be rather easily
resurected.
I suggest, on top of the current series:
PATCH 3 : (re)introduce git_config_iter, compatible with git_config
(one variant with a configset argument, another working on the_config_set).
PATCH 4 : rename git_config to e.g. git_config_parse, and
git_config_iter to git_config.
Then, check that tests still pass (PATCH 4 automatically uses the new
code essentially in every place where Git deals with config, so existing
tests will start to stress the code a lot more), and check with e.g.
"strace -e open git ..." that config files are now parsed only once
where they used to be parsed multiple times.
I'd do that as a separate series, to let the current one finally reach
pu.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2014-07-10 9:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 10:57 [PATCH v6 0/3] git config cache & special querying api utilizing the cache Tanay Abhra
2014-07-09 10:57 ` [PATCH v7 1/2] add `config_set` API for caching config-like files Tanay Abhra
2014-07-09 12:12 ` Matthieu Moy
2014-07-09 12:39 ` Tanay Abhra
2014-07-09 14:19 ` Matthieu Moy
2014-07-09 15:17 ` Junio C Hamano
2014-07-09 17:44 ` Junio C Hamano
2014-07-10 9:41 ` Matthieu Moy [this message]
2014-07-10 16:46 ` Junio C Hamano
2014-07-09 16:07 ` Tanay Abhra
2014-07-10 11:23 ` Matthieu Moy
2014-07-09 10:57 ` [PATCH v7 2/2] test-config: Add tests for the config_set API Tanay Abhra
2014-07-09 12:13 ` Matthieu Moy
2014-07-09 12:42 ` Tanay Abhra
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=vpqa98hwnxp.fsf@anie.imag.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tanayabh@gmail.com \
/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).