git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 2/4] path: optimize common dir checking

From
David Turner <dturner@twopensource.com>
Date
Aug 28, 2015, 18:36 UTC
Message-ID
<1440787007.25570.0.camel@twopensource.com>
In-Reply-To
<xmqqoahr2wqj.fsf@gitster.mtv.corp.google.com>
On Fri, 2015-08-28 at 09:39 -0700, Junio C Hamano wrote:
Show 56 quoted lines
> 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.
Previous: Junio C HamanoNext: Torsten Bögershausen
Message 9 of 13 in “per-worktree bisection refs”
  1. 0/4 per-worktree bisection refsDavid Turner, Aug 26, 2015
  2. 1/4 refs: clean up common_listDavid Turner, Aug 26, 2015
  3. 2/4 path: optimize common dir checkingDavid Turner, Aug 26, 2015
  4. Junio C HamanoAug 26, 2015
  5. David TurnerAug 26, 2015
  6. Junio C HamanoAug 26, 2015
  7. David TurnerAug 26, 2015
  8. Junio C HamanoAug 28, 2015
  9. David TurnerAug 28, 2015
  10. Torsten BögershausenAug 30, 2015
  11. David TurnerAug 31, 2015
  12. 3/4 refs: make refs/worktree/* per-worktreeDavid Turner, Aug 26, 2015
  13. 4/4 bisect: make bisection refs per-worktreeDavid Turner, Aug 26, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.