Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Extended globbing seems to have become much slower in recent versions of Zsh
- X-seq: zsh-users 21334
- From: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Extended globbing seems to have become much slower in recent versions of Zsh
- Date: Tue, 1 Mar 2016 12:39:43 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=R6TW8d0UlN9C7tun3smoylhlko+SG3qn1lWzYcHX1/Q=; b=TgzdS1JfLqYaTOwftER3v0xiCna6fQu0OGd9ZEO7rYm0gON4vgFQzwZsOxOFWe4i2u Z5Bs3m4uHf35NQIleSL39fkZj1CYo2kHp6LaVavIUHHFc48Khu+v6QC1ZsBA4Jg0ty5+ Bia2DixPsxszaLZYSOmSzst4qn3KuRKMrsUH18n1vUAD3C5/3Whu1QysrJt/W0WR23oj JSEhkfuMK94WHQuMHwae5PEcc5IHUHkHBoMaAwOZ6nZHfSxwbJj1XBlIk6WSaeevqEvG NQjZ7DSNyy8ZMv9VIF0e52QI0wLG5ocS0CdhDDE5aypIBR/Z8kzS0t0pRtvzxBG1XFnq zlkw==
- In-reply-to: <160229111212.ZM4272@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABZhJg--GUe_1zfXxvvX4Dn=t8MgqG2e7poFCSFKKtC3a3AQ7g@mail.gmail.com> <160229111212.ZM4272@torch.brasslantern.com>
Here's another run with your supplied patterns. I hope I didn't
misunderstand how you wanted me to use the SECONDS variable.
In any case, as you can see below, the globbing more or less takes the same
time for the simple patterns, but as soon as I introduce the exclusions,
the 5.2 version is around six times slower than the 5.0.5 version.
% du -sh .
2.4G .
% print -l **/*(D) | wc -l
272681
------------------------------------------------------
% /usr/local/bin/zsh --version
zsh 5.2 (x86_64-apple-darwin14.5.0)
% /usr/local/bin/zsh -f
% pwd
/opt/intyg
% setopt EXTENDED_GLOB
% float SECONDS MYNOW
% MYNOW=$SECONDS; myfiles=(**/*); print $(( $SECONDS - $MYNOW ))
20.477513999999996
% MYNOW=$SECONDS; myfiles=(**/*(-.D)); print $(( $SECONDS - $MYNOW ))
20.415430000000001
% MYNOW=$SECONDS;
myfiles=(**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D));
print $(( $SECONDS - $MYNOW ))
36.53519
% MYNOW=$SECONDS;
myfiles=((#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D));
print $(( $SECONDS - $MYNOW ))
38.467647999999997
% MYNOW=$SECONDS;
myfiles=(**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*));
print $(( $SECONDS - $MYNOW ))
23.871832999999981
MYNOW=$SECONDS;
myfiles=((#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*));
print $(( $SECONDS - $MYNOW ))
23.234887999999955
-------------------------------------------------------
% /bin/zsh --version
zsh 5.0.5 (x86_64-apple-darwin14.0)
% /bin/zsh -f
% pwd
/opt/intyg
% setopt EXTENDED_GLOB
% float SECONDS MYNOW
% MYNOW=$SECONDS; myfiles=(**/*); print $(( $SECONDS - $MYNOW ))
15.603122999999997
% MYNOW=$SECONDS; myfiles=(**/*(-.D)); print $(( $SECONDS - $MYNOW ))
17.826644999999999
% MYNOW=$SECONDS;
myfiles=(**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D));
print $(( $SECONDS - $MYNOW ))
6.5746579999999994
% MYNOW=$SECONDS;
myfiles=((#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D));
print $(( $SECONDS - $MYNOW ))
6.1519139999999766
% MYNOW=$SECONDS;
myfiles=(**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*));
print $(( $SECONDS - $MYNOW ))
3.6434740000000261
% MYNOW=$SECONDS;
myfiles=((#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*));
print $(( $SECONDS - $MYNOW ))
4.0673059999999737
On Mon, Feb 29, 2016 at 8:12 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:
> On Feb 28, 9:18pm, Jesper Nygards wrote:
> }
> } The results of my experiments seem to indicate that something has changed
> } relatively recently with regards to extended globbing.
>
> There were a number of changes mostly related to correct handling of
> multibyte characters and single bytes in the range 128-255 appearing
> in file and directory names. This means some strings are passing
> through the "unmetafication" process more often than they were, but
> I can't say for sure this is the source of any slowdown.
>
> It'd be helpful if you re-ran your tests with more variations of the
> pattern:
>
> **/*
> **/*(-.D)
> **/*~(your long list of exclusions)
> (#i)**/*~(your long list of exclusions)
> **/*~(your long list of exclusions)(-.D)
>
> Also, first declare "float SECONDS" and then use "print $SECONDS" instead
> of "date", so we get a more precise measure of where the time is spent.
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author