From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6433 invoked by alias); 7 Mar 2016 09:59:38 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21369 Received: (qmail 17507 invoked from network); 7 Mar 2016 09:59:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 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=+/BPzrnqHHk34C9QekMUKyRJ3jr2fFyNiJJ916D+cZQ=; b=BRypupZ+0NDR3PS1zHfWV6Pm+xP5XDtZ35AwZb/e/P7hPaU8qxwKZOuhY3EOMG3ZM+ oTuuYiLr+0YU6JdIycc/WT7mIsZzb0zY0MK36L93XQ1r1o1bIXqfXBoMZCph1hFN7YTt ZtoqIr2GX0C32Cdt/PB2JCwVRG/wPuKxz7vq1dxYPBpPSuYE3teNHdgVb7EIGhnXv2yx GrTxsipRtyPf45dWO/stWcfW09GIVnk+OvE1nxa3fGy14/EXew0Ib1CUKtojKpQx6yt6 RGLtj5XrsZENPOTG/3dFp064sjL+N38wc03CCWTf/O5XihRxJAbbr5iy2HfeCd82dKxz +HUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=+/BPzrnqHHk34C9QekMUKyRJ3jr2fFyNiJJ916D+cZQ=; b=SJYHYk5I/7jNOSxD9TjSzom9KcuuzayTrrFtmblyY2M4qWnxbW852+ukDXgXIgbVEa eRkzNWJhgH6NPDstAo4aNQgEk8JfGMOVMU376hHJg1m5cQkw0Qsb8Doaw09QOtKUqkJA fgvW7kx6ykK8kBMI696x6RNlInAhtWBNM7nIW8MsNnx4iKeYhl+I/pClADgb7EmNIDx1 dyTPHUML+jPTri9pyIRx5CervAgqak/D/sTsy9eMoAfJN0lufJIQg1ZfDfX6ABA80ASA 96TN3aFiy+9Q6xBLIG9stgW447EPSYTuIZjcjkk68UQ+5Xl7sF0+mTq3u/GAZyl8TyEW 5sDg== X-Gm-Message-State: AD7BkJIuWrRoIWcNDoJ4fF0BFjU8lF5mBCMn7Aulp1yJ45rYYsdlLJun2nj9dHAyOHZQEU/yvmEcvuGo5+zVNA== MIME-Version: 1.0 X-Received: by 10.25.165.20 with SMTP id o20mr7643236lfe.105.1457344771201; Mon, 07 Mar 2016 01:59:31 -0800 (PST) In-Reply-To: <20160306181009.412c31be@ntlworld.com> References: <160229111212.ZM4272@torch.brasslantern.com> <160301102807.ZM8036@torch.brasslantern.com> <160301160356.ZM10258@torch.brasslantern.com> <20160304140342.4477e2c1@pwslap01u.europe.root.pri> <20160304142046.7e1bc9ba@pwslap01u.europe.root.pri> <20160304214921.06c6587f@ntlworld.com> <160305094723.ZM22954@torch.brasslantern.com> <20160306181009.412c31be@ntlworld.com> Date: Mon, 7 Mar 2016 10:59:31 +0100 Message-ID: Subject: Re: Extended globbing seems to have become much slower in recent versions of Zsh From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= To: Zsh Users Content-Type: multipart/alternative; boundary=001a11411a5467225a052d7285f0 --001a11411a5467225a052d7285f0 Content-Type: text/plain; charset=UTF-8 I see no real difference with or without Peter's patch, I'm afraid. I will incorporate the suggestions from Bart in my solution. But I feel I haven't explained very well (or at all) what I'm trying to achieve. I use this kind of globbing in a sort of "recursive grep" which I use interactively to grep in my project's codebase. The inputs to the script include both patterns that I search for and patterns that I want to exclude. Up until now, I have composed the list of exclusions from the input without separating ordinary files from directories, but Bart's tip made me aware that such a separation would be worth doing to make it faster. As a side note, since I have implemented this in zsh, I followed what I thought was "zsh best practice", and composed this rather complicated file list with a zsh glob expression, instead of relying on an external command such as gnu "find". But after I discovered this bottle neck in my scripts, I have experimented with instead letting "find" find the files, and indeed that seems a whole lot faster. I mention that just to be sure that I am not causing you to waste your time if my use case is so extreme that it's not worth bothering about its performance. On Sun, Mar 6, 2016 at 7:10 PM, Peter Stephenson < p.w.stephenson@ntlworld.com> wrote: > On Sat, 5 Mar 2016 09:47:23 -0800 > Bart Schaefer wrote: > > On Mar 4, 9:49pm, Peter Stephenson wrote: > > } Subject: Re: Extended globbing seems to have become much slower in > recent > > } > > } This is what I meant. It may not be related to the slow down in > > } question, but it should speed up repeated use of exclusion patterns in > > } any case. > > > > Sadly, on my desktop this actually SLOWS DOWN the process even further. > > The below is for a glob of 13,000 files (largest/deepest tree I have > > handy) with "repeat 3" and Jesper's pattern: > > That suggests either I've made a mistake in the optimisation portion > (which I didn't explicit test, only that it gave the correct behaviour), > or the repeated allocation ad nfreeing of similar length strings is > close to optimal in allocation already... or a combination. > > pws > --001a11411a5467225a052d7285f0--