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



New runs with your suggestion:


% /usr/local/bin/zsh --version
zsh 5.2 (x86_64-apple-darwin14.5.0)

% /usr/local/bin/zsh -f
% setopt EXTENDED_GLOB; float SECONDS MYNOW

% MYNOW=$SECONDS; :
**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D);
print $(( $SECONDS - $MYNOW ))
36.463269999999994

% MYNOW=$SECONDS; :
(#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D);
print $(( $SECONDS - $MYNOW ))
45.178413000000006

% MYNOW=$SECONDS; :
**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*);
print $(( $SECONDS - $MYNOW ))
26.012812999999994

% MYNOW=$SECONDS; :
(#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*);
print $(( $SECONDS - $MYNOW ))
23.646717999999964

-------------------------------------------------------

% /bin/zsh --version
zsh 5.0.5 (x86_64-apple-darwin14.0)

% /bin/zsh -f
% setopt EXTENDED_GLOB; float SECONDS MYNOW

% MYNOW=$SECONDS; :
**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D);
print $(( $SECONDS - $MYNOW ))
13.899865999999989

% MYNOW=$SECONDS; :
(#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D);
print $(( $SECONDS - $MYNOW ))
10.239834999999999

% MYNOW=$SECONDS; :
**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*);
print $(( $SECONDS - $MYNOW ))
5.4469640000000084

% MYNOW=$SECONDS; :
(#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*);
print $(( $SECONDS - $MYNOW ))
6.2737860000000296


On Tue, Mar 1, 2016 at 7:28 PM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:

> On Mar 1, 12:39pm, Jesper Nygards wrote:
> }
> } Here's another run with your supplied patterns. I hope I didn't
> } misunderstand how you wanted me to use the SECONDS variable.
>
> Close enough.
>
> } 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.
>
> That tends to point to changes in pattern matching rather than globbing
> (related but distinct operations), but can you also try it with
>
>     : pattern-goes-here
>
> instead of
>
>     myfiles=( pattern-goes-here )
>
> ??  I'd like to factor out the contributions of memory management for the
> array assignment.  I ran a couple of quick local tests and with assignment
> there are about 50% more calls to malloc in the current git head than in
> 5.0.5, but without assignment there are slightly fewer in current.
>


Messages sorted by: Reverse Date, Date, Thread, Author