git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Forrest <nobozo@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Question About Sorting the Index
Date: Tue, 27 May 2025 09:38:59 -0700	[thread overview]
Message-ID: <9befdb3e-ff6e-4416-8735-1eea99dbbf01@gmail.com> (raw)
In-Reply-To: <xmqqfrh3qe2w.fsf@gitster.g>



On 5/17/25 11:36 AM, Junio C Hamano wrote:

> For example, the fact that the index is first read into core, each
> entry is represented as a cache_entry in-core structure, and the
> code accesses them via an array active_cache[], and that array is
> sorted per pathnames, haven't changed.  

I had a thought. What if the in-memory cache were stored in a hash,
where the pathname is the key? That way nothing would have to be
sorted in order to lookup a particular file.

The on-disk index could be in any order.

I don't know how the overhead of creating the hash when a
git program starts compares to that of creating the
cache_entry struct and then later doing the sorting.
This seems like the key question.

Jon



  parent reply	other threads:[~2025-05-27 16:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-16 23:43 Question About Sorting the Index Jon Forrest
2025-05-17  3:46 ` Re " K Jayatheerth
2025-05-17 17:20   ` Jon Forrest
2025-05-17 18:36 ` Junio C Hamano
2025-05-17 18:48   ` Jon Forrest
2025-05-18  5:13     ` Elijah Newren
2025-05-18 15:13       ` Jon Forrest
2025-05-27 16:38   ` Jon Forrest [this message]
2025-05-28  2:34     ` Junio C Hamano

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=9befdb3e-ff6e-4416-8735-1eea99dbbf01@gmail.com \
    --to=nobozo@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).