From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: Sebastian Gniazdowski <psprint@zdharma.org>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Performance tests of quoting and dequoting, printf -v turned out slow
Date: Fri, 9 Mar 2018 13:23:44 +0000 [thread overview]
Message-ID: <20180309132344.GA20986@chaz.gmail.com> (raw)
In-Reply-To: <etPan.5aa22836.70671812.159ee@zdharma.org>
2018-03-09 07:22:46 +0100, Sebastian Gniazdowski:
> Hello
> Two scripts:
>
> - short.txt
> Test of quoting, (q)-flag vs. printf -v output '%q '
> result: 35 ms vs. 26.6 sec
>
> - Q_short.txt – test of dequoting, (Q)-flag vs. eval "str=$quoted"
> result: 25 ms vs. 77 ms
>
> I've compared "printf -v" code to Bash 4.4 and it yields 227
> ms there, so much better than 26.6 sec. So while "Bash can
> serialize/deserialize too, let's compare speed of this method"
> is interesting thing and I share, performance of "printf -v"
> on Zsh is troubling. Any idea from where it comes from and if
> it can be improved?
[...]
I can't reproduce with zsh 5.4.2 (x86_64-debian-linux-gnu)
compared with 4.4.18(1)-release (x86_64-pc-linux-gnu).
in a en_GB.UTF-8 locale.
FWIW, I find:
$ time INPUT='ice as"program" pick"$ZPFX/bin/prll_(qer|bfr)" src"prll.sh" make"install PREFIX=$ZPFX"' bash -c 'for ((i = 0; i < 50000; i++)); do printf -v OUTPUT %q "$INPUT"; done'
INPUT= bash -c 1.48s user 0.00s system 99% cpu 1.485 total
$ time INPUT='ice as"program" pick"$ZPFX/bin/prll_(qer|bfr)" src"prll.sh" make"install PREFIX=$ZPFX"' zsh -c 'for ((i = 0; i < 50000; i++)); do printf -v OUTPUT %q "$INPUT"; done'
INPUT= zsh -c 0.83s user 0.14s system 99% cpu 0.979 total
What's your version and locale?
--
Stephane
next prev parent reply other threads:[~2018-03-09 13:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 6:22 Sebastian Gniazdowski
2018-03-09 13:23 ` Stephane Chazelas [this message]
[not found] ` <etPan.5aa28b1e.77e79f33.159ee@AirmailxGenerated.am>
2018-03-09 13:39 ` Sebastian Gniazdowski
2018-03-09 14:53 ` Stephane Chazelas
2018-03-10 8:36 ` Sebastian Gniazdowski
2018-03-10 15:03 ` Stephane Chazelas
[not found] ` <etPan.5aa3f656.1efba338.159ee@AirmailxGenerated.am>
2018-03-10 16:53 ` Sebastian Gniazdowski
2018-03-10 15:40 ` Oliver Kiddle
2018-03-11 8:33 ` Bart Schaefer
2018-03-13 11:28 ` Sebastian Gniazdowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180309132344.GA20986@chaz.gmail.com \
--to=stephane.chazelas@gmail.com \
--cc=psprint@zdharma.org \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).