git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: "Carlos Pita" <carlosjosepita@gmail.com>,
	"“git@vger.kernel.org”" <git@vger.kernel.org>
Subject: Re: Index files autocompletion too slow in big repositories (w / suggestion for improvement)
Date: Fri, 14 Apr 2017 18:37:08 -0700	[thread overview]
Message-ID: <CA+P7+xoBYApdmucEpdxT8qHJ0HP5RR2gOkStykd5Fq=8qsZxZQ@mail.gmail.com> (raw)
In-Reply-To: <CACBZZX7Ajf1c9YKP=MO0T9SV7d0-XZsT=RthJocqZw4_TcCcQw@mail.gmail.com>

On Fri, Apr 14, 2017 at 3:33 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> On Sat, Apr 15, 2017 at 12:08 AM, Carlos Pita <carlosjosepita@gmail.com> wrote:
>> This is much faster (below 0.1s):
>>
>> __git_index_files ()
>> {
>>     local dir="$(__gitdir)" root="${2-.}" file;
>>     if [ -d "$dir" ]; then
>>         __git_ls_files_helper "$root" "$1" | \
>>             sed -r 's@/.*@@' | uniq | sort | uniq
>>     fi
>> }
>>
>> time __git_index_files
>>
>> real    0m0.075s
>> user    0m0.083s
>> sys    0m0.010s
>>
>> Most of the improvement is due to the simpler, non-grouping, regex.
>> Since I expect most of the common prefixes to arrive consecutively,
>> running uniq before sort also improves things a bit. I'm not removing
>> leading double quotes anymore (this isn't being done by the current
>> version, anyway) but this doesn't seem to hurt.
>>
>> Despite the dependence on sed this is ten times faster than the
>> original, maybe an option to enable fast index completion or something
>> like that might be desirable.
>>
>> Best regards
>
> It's fine to depend on sed, these shell-scripts are POSIX compatible,
> and so is sed, we use sed in a lot of the built-in shellscripts.
>
> I think you should submit this as a patch, see Documentation/SubmittingPatches.

Yea it should be fine to use sed.

Thanks,
Jake

  reply	other threads:[~2017-04-15  1:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14 20:06 Index files autocompletion too slow in big repositories (w / suggestion for improvement) Carlos Pita
2017-04-14 22:08 ` Carlos Pita
2017-04-14 22:33   ` Ævar Arnfjörð Bjarmason
2017-04-15  1:37     ` Jacob Keller [this message]
2017-04-15  7:52       ` Junio C Hamano
2017-04-15 11:59     ` Johannes Sixt
2017-04-16  0:31       ` Jacob Keller
2017-04-17  4:05       ` Junio C Hamano
2017-04-17  8:03         ` Johannes Sixt
2017-04-15 12:30     ` Johannes Sixt

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+P7+xoBYApdmucEpdxT8qHJ0HP5RR2gOkStykd5Fq=8qsZxZQ@mail.gmail.com' \
    --to=jacob.keller@gmail.com \
    --cc=avarab@gmail.com \
    --cc=carlosjosepita@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).