zsh-users
 help / color / mirror / code / Atom feed
* Extended globbing seems to have become much slower in recent versions of Zsh
@ 2016-02-28 20:18 Jesper Nygårds
  2016-02-29 19:12 ` Bart Schaefer
  0 siblings, 1 reply; 22+ messages in thread
From: Jesper Nygårds @ 2016-02-28 20:18 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]

I had a feeling that some of my scripts dealing with a large number of
files had become significantly slower lately, but I haven't been sure.
Today I took some time to find out whether or not I was only imagining
things.

The results of my experiments seem to indicate that something has changed
relatively recently with regards to extended globbing. I am using a Mac for
the moment, and I have currently have two versions of Zsh installed: 5.0.5
and 5.2. See below for my test run. As you can see, I do some globbing in a
fairly large directory (2.4 Gb and 231748 files). Notice that with a
complicated glob pattern, assigning matching files to an array takes about
33 seconds under 5.2, whereas the same assignment takes about 6 seconds
under 5.0.5. The speed difference with a less complicated glob (**/*) is
negligable.

Is there some change that could explain this difference, and is there
something to do about it? The difference in speed is so large that it
affects scripts that I run regularly quite a lot.

The test run, I hope it's self explanatory. All commands are run from the
same directory.

% print -l **/* | wc -l
231748

% du -sh .
2.4G .


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

% /usr/local/bin/zsh -f
% setopt EXTENDED_GLOB

% date; myfiles=(**/*); date
Sun Feb 28 20:58:12 CET 2016
Sun Feb 28 20:58:27 CET 2016

% date;
myfiles=((#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D));
date
Sun Feb 28 20:58:39 CET 2016
Sun Feb 28 20:59:12 CET 2016


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

% /bin/zsh -f
% setopt EXTENDED_GLOB

% date; myfiles=(**/*); date
Sun Feb 28 21:00:43 CET 2016
Sun Feb 28 21:00:56 CET 2016

% date;
myfiles=((#i)**/*~(|*/)(build|target|node|node_modules|.idea|*.min.js|*.iml|TAGS)(|/*)(-.D));
date
Sun Feb 28 21:01:04 CET 2016
Sun Feb 28 21:01:10 CET 2016

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2016-03-21 23:05 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-28 20:18 Extended globbing seems to have become much slower in recent versions of Zsh Jesper Nygårds
2016-02-29 19:12 ` Bart Schaefer
2016-03-01 11:39   ` Jesper Nygårds
2016-03-01 18:28     ` Bart Schaefer
2016-03-01 19:11       ` Jesper Nygårds
2016-03-02  0:03         ` Bart Schaefer
2016-03-02  8:39           ` Jesper Nygårds
2016-03-03  0:06             ` Bart Schaefer
2016-03-04  8:17               ` Jesper Nygårds
2016-03-04 13:22                 ` Jesper Nygårds
2016-03-04 14:03                   ` Peter Stephenson
2016-03-04 14:20                     ` Peter Stephenson
2016-03-04 21:49                       ` Peter Stephenson
2016-03-05 17:47                         ` Bart Schaefer
2016-03-06 18:10                           ` Peter Stephenson
2016-03-07  9:59                             ` Jesper Nygårds
2016-03-07 10:15                               ` Peter Stephenson
2016-03-05 17:37                   ` Bart Schaefer
2016-03-06 17:31                     ` Bart Schaefer
2016-03-21 23:05                       ` Bart Schaefer
2016-03-02  9:32           ` Peter Stephenson
2016-03-02 23:46             ` Bart Schaefer

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