From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12473 invoked by alias); 10 Mar 2018 15:03:19 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42441 Received: (qmail 3660 invoked by uid 1010); 10 Mar 2018 15:03:19 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f45.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.45):SA:0(-1.9/5.0):. Processed in 1.083678 secs); 10 Mar 2018 15:03:19 -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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=07/TMMaoXOqBVdec8HISPGCN0Q2zCP4eFBXBn75pR8Y=; b=Yu1JepKQj4gfxeVkM7idQCdcdGCVMvRoyvZRgbMVT4UbO0aS4DHnyuLluz/UVXKjXB ES1QEsfNyHcKml3/1yZEzjAhuqBolanQeAk8lWmrcXQEbI0zZp0cytI5qpi/ExY3zrer VQ10ioaZbXQ6mxf02DZG6zn25fW6WlESu5qeK6GProAzWgkw3XAQu5hFpb1vjbxlGl0C BU6QK9KFRNkHjIdo/9/Cbn/59LB4BRdu6ayHFOcxsvNjGG47/b2WmJcC1zMbPJfUPHfg 7emnZN+7l5l81h8ycOec4ptFnFfuQtdXEoqznyLdesRXSa8qBeGuWawVkBMN20cm5tmG OZmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=07/TMMaoXOqBVdec8HISPGCN0Q2zCP4eFBXBn75pR8Y=; b=en1Bm3vJKbDQjj40fWnPM8zTo6csorZMMCzK2bD5ak7hpoRgXpBoiSb4zo6TEirW4d 2jN5nQWg/jlvZyNFq8rmHA7AxkANVg582J4Ga6mKi2BzztxRrXpgR+5aAWmoxPG1hkIb sCG0bgEPDnP7J84/fmjNTvrZe4WfYOYh76+qoklBkFI71WJb96lPaR30iS0NqXs38u+R LFj9H4J7JRL/N8heznV0vlhEssCKwj+qAUVOmpXzH1epLlGgWplKnVVKvuxFmJ+LldhM Rt1Jg8qoobW4rqGSBpddsNB5ttlHHAqkhidS1DNrasL9sdtzAp88GvLyvkGTadV4Jdg/ bpDw== X-Gm-Message-State: AElRT7HH74OtO36tyW06ymmDtLW1LTP5nHk8Ij24Cih/xWt1Doi3EvXL NW+mVaR+JqaPgBg3y/iQdbdGlA== X-Google-Smtp-Source: AG47ELszKZsPJ5E0/zYokSA34mYrQ4rRZz35W2YgaO3tdoktsHiWxdhZygZsUlCgUsgeOdX/OY5Miw== X-Received: by 10.28.190.18 with SMTP id o18mr1396066wmf.86.1520694193788; Sat, 10 Mar 2018 07:03:13 -0800 (PST) Date: Sat, 10 Mar 2018 15:03:11 +0000 From: Stephane Chazelas To: Sebastian Gniazdowski Cc: Zsh hackers list Subject: Re: Performance tests of quoting and dequoting, printf -v turned out slow Message-ID: <20180310150311.GA15390@chaz.gmail.com> Mail-Followup-To: Sebastian Gniazdowski , Zsh hackers list References: <20180309145352.GB20986@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) 2018-03-10 09:36:42 +0100, Sebastian Gniazdowski: [...] > I only changed method of time measurement in your snippet, and obtained the slowness: > > % typeset -F3 SECONDS=0; INPUT='ice as"program" pick"$ZPFX/bin/prll_(qer|bfr)" src"prll.sh" make"install PREFIX=$ZPFX"'; for ((i = 0; i < 50000; i++)); do printf -v OUTPUT '%q' "$INPUT"; done; echo $SECONDS > 151.137 [...] > > Not sure what using `time' instead of $SECONDS does, but above method is less suspected of any side effects. [...] More importantly here, the difference is that you have that code interpreted by your interactive shell that has read your ~/.zshrc, while the "time" version starts a new non-interactive shell that doesn't read ~/.zshrc to interpret the code. There is probably something in your interactive shell environment that is causing that. What do you see, if you run: (set -x; repeat 5 printf -v x x) What's the output of: type printf trap Do you get the same behaviour if you run that same code after "zsh -f" (a new interactive shell instance that doesn't read your ~/.zshrc)? -- Stephane