Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Extended globbing seems to have become much slower in recent versions of Zsh
- X-seq: zsh-users 21328
- From: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Extended globbing seems to have become much slower in recent versions of Zsh
- Date: Sun, 28 Feb 2016 21:18:30 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=qKKNRg1vk/UTBnNBbP+mIIMHhVDgZSMw9NH7thIB0wI=; b=YEQsmGAebK9qe7nrp63XYmdcf79tObsdx+rn7ZYQ0Cb52r5YvFirjEGwruJkdrXgp6 Hd+AbXkYf3V3y1V1+KE+SdHaPc1d83ZUUDsKOKqUgWkw9pAYwXSO1C8jmVfV/g1TtJ5l OqB733cscmqoCxmyLiBYYFOkVgXwGwHmuw3z9yOBPaSWhhimt6hd0yiA4o6NhDcY45rA dSkjipMQj4RpGN3heFWqmLp6o//pqhswmuJwOuEp/vp5ylwdnP3/R6IHIV4fleqK1BIe PzzGWaOb7l6vPPJrwbJH9Z8r+d9+zC5UR9n9huL8b8/qTHx39mDa9fBTiNJxYqmdreCx 9bkw==
- 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
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author