Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [RFC] Case-insensitive path completion in _git
- X-seq: zsh-workers 48282
- From: dana <dana@xxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [RFC] Case-insensitive path completion in _git
- Date: Sun, 28 Mar 2021 00:07:17 -0500
- Archived-at: <https://zsh.org/workers/48282>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-03/1C958552-603A-4716-8D4B-EF1EDA6D304F%40dana.is>
- In-reply-to: <20210327210826.GJ18178@tarpaulin.shahaf.local2>
- List-id: <zsh-workers.zsh.org>
- References: <B25A8850-A141-4B81-A3E6-017F280B0CC6@dana.is> <c7ece4f3-86e4-36d8-527a-e99f8a8f11d1@googlemail.com> <20210327210826.GJ18178@tarpaulin.shahaf.local2>
On 27 Mar 2021, at 16:08, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author