zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [RFC] Case-insensitive path completion in _git
Date: Sun, 28 Mar 2021 00:07:17 -0500	[thread overview]
Message-ID: <1C958552-603A-4716-8D4B-EF1EDA6D304F@dana.is> (raw)
In-Reply-To: <20210327210826.GJ18178@tarpaulin.shahaf.local2>

On 27 Mar 2021, at 16:08, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> What about the default use-case — no matchspec and case-sensitive
> matching?  The patch transforms a plain string to a list of character
> classes, and it's not clear to me what costs that might incur on large
> trees.

I recently learnt that ls-files actually does support case-insensitive
matching using the following syntax:

  :(icase)/foo/bar/baz

Whether there might still be performance issues with it — i ran a quick test
against the Linux tree and it looks good enough to me, but idk how to make it
conclusive:

  % hyperfine --warmup=3 \
    "git ls-files -- ${(q)PWD}/'*Kbuild*'" \
    "git ls-files -- ${(q)PWD}/'*[Kk][Bb][Uu][Ii][Ll][Dd]*'" \
    "git ls-files -- ':(icase)'${(q)PWD}/'*kbuild*'"

  Benchmark #1: git ls-files -- /home/dana/linux/'*Kbuild*'
    Time (mean ± σ):      27.4 ms ±   0.9 ms    [User: 18.5 ms, System: 8.8 ms]
    Range (min … max):    26.0 ms …  31.9 ms    102 runs

  Benchmark #2: git ls-files -- /home/dana/linux/'*[Kk][Bb][Uu][Ii][Ll][Dd]*'
    Time (mean ± σ):      71.2 ms ±   1.0 ms    [User: 62.9 ms, System: 8.2 ms]
    Range (min … max):    70.1 ms …  76.0 ms    41 runs

  Benchmark #3: git ls-files -- ':(icase)'/home/dana/linux/'*kbuild*'
    Time (mean ± σ):      32.2 ms ±   0.6 ms    [User: 23.1 ms, System: 9.1 ms]
    Range (min … max):    30.7 ms …  33.9 ms    90 runs

  Summary
    'git ls-files -- /home/dana/linux/'*Kbuild*'' ran
      1.18 ± 0.04 times faster than 'git ls-files -- ':(icase)'/home/dana/linux/'*kbuild*''
      2.60 ± 0.09 times faster than 'git ls-files -- /home/dana/linux/'*[Kk][Bb][Uu][Ii][Ll][Dd]*''

It could still be gated behind a style if it's a concern.

dana



  reply	other threads:[~2021-03-28  5:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-13  4:40 dana
2020-12-13 13:55 ` m0viefreak
2020-12-14 10:25   ` dana
2021-03-27 21:08   ` Daniel Shahaf
2021-03-28  5:07     ` dana [this message]
2021-03-28  8:08       ` Oliver Kiddle
2021-03-30  5:59         ` dana
2021-04-10 20:43           ` Lawrence Velázquez
2021-04-10 20:56             ` dana
2021-03-27 20:06 ` Lawrence Velázquez

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=1C958552-603A-4716-8D4B-EF1EDA6D304F@dana.is \
    --to=dana@dana.is \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.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://git.vuxu.org/mirror/zsh/

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).