From: David Turner <dturner@twopensource.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, mhagger@alum.mit.edu, pclouds@gmail.com,
sunshine@sunshineco.com
Subject: Re: [PATCH v4 2/4] path: optimize common dir checking
Date: Fri, 28 Aug 2015 14:36:47 -0400 [thread overview]
Message-ID: <1440787007.25570.0.camel@twopensource.com> (raw)
In-Reply-To: <xmqqoahr2wqj.fsf@gitster.mtv.corp.google.com>
On Fri, 2015-08-28 at 09:39 -0700, Junio C Hamano wrote:
> David Turner <dturner@twopensource.com> writes:
>
> > On Wed, 2015-08-26 at 18:10 -0400, David Turner wrote:
> >> On Wed, 2015-08-26 at 14:15 -0700, Junio C Hamano wrote:
> >> > > + * For example, consider the following set of strings:
> >> > > + * abc
> >> > > + * def
> >> > > + * definite
> >> > > + * definition
> >> > > + *
> >> > > + * The trie would look look like:
> >> > > + * root: len = 0, value = (something), children a and d non-NULL.
> >> >
> >> > "value = NULL", as there is no empty string registered in the trie?
> >>
> >> Indeed.
> >>
> >> > > + * a: len = 2, contents = bc
> >> >
> >> > "value = NULL" here, too (just showing I am following along, not
> >> > just skimming)?
> >>
> >> Yep.
> >
> > No, wait. value should be non-NULL, since abc is in the string set.
>
> True. Here is what I came up with on top of your original.
>
>
>
> path.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/path.c b/path.c
> index 4100ba6..ce0530b 100644
> --- a/path.c
> +++ b/path.c
> @@ -133,12 +133,13 @@ struct common_dir common_list[] = {
> * definition
> *
> * The trie would look look like:
> - * root: len = 0, value = (something), children a and d non-NULL.
> - * a: len = 2, contents = bc
> - * d: len = 2, contents = ef, children i non-NULL, value = (something)
> + * root: len = 0, children a and d non-NULL, value = NULL.
> + * a: len = 2, contents = bc, value = (data for "abc")
> + * d: len = 2, contents = ef, children i non-NULL, value = (data for "def")
> * i: len = 3, contents = nit, children e and i non-NULL, value = NULL
> - * e: len = 0, children all NULL, value = (something)
> - * i: len = 2, contents = on, children all NULL, value = (something)
> + * e: len = 0, children all NULL, value = (data for "definite")
> + * i: len = 2, contents = on, children all NULL,
> + * value = (data for "definition")
> */
> struct trie {
> struct trie *children[256];
LGTM.
next prev parent reply other threads:[~2015-08-28 18:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 19:46 [PATCH v4 0/4] per-worktree bisection refs David Turner
2015-08-26 19:46 ` [PATCH v4 1/4] refs: clean up common_list David Turner
2015-08-26 19:46 ` [PATCH v4 2/4] path: optimize common dir checking David Turner
2015-08-26 21:15 ` Junio C Hamano
2015-08-26 22:10 ` David Turner
2015-08-26 22:15 ` Junio C Hamano
2015-08-26 22:19 ` David Turner
2015-08-28 16:39 ` Junio C Hamano
2015-08-28 18:36 ` David Turner [this message]
2015-08-30 6:25 ` Torsten Bögershausen
2015-08-31 18:56 ` David Turner
2015-08-26 19:46 ` [PATCH v4 3/4] refs: make refs/worktree/* per-worktree David Turner
2015-08-26 19:46 ` [PATCH v4 4/4] bisect: make bisection refs per-worktree David Turner
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=1440787007.25570.0.camel@twopensource.com \
--to=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
--cc=pclouds@gmail.com \
--cc=sunshine@sunshineco.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).