Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Performance tests of quoting and dequoting, printf -v turned out slow
- X-seq: zsh-workers 42436
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Sebastian Gniazdowski <psprint@xxxxxxxxxxx>
- Subject: Re: Performance tests of quoting and dequoting, printf -v turned out slow
- Date: Fri, 9 Mar 2018 13:23:44 +0000
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- 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:content-transfer-encoding :in-reply-to:user-agent; bh=WAZtSPF3/BFCWp0X5thZfmCeTcjazePNUqQlPKC1tw0=; b=NB7KqQEbP9R4REUim0Gu3AYdL77KAKBa2JdT5su1b5G1N7G9xOmQWeAQcUw57PqlLh 9hxIo4yqxFTNi9f8N4qIaqnD7tzby0YNz0OHBdCbXlcA7GvMJ8qyZpi1bOO9WdIU14Z1 Zb2uHPNOtCrTJstj9OvCZSQuFSsH7FrLO0osS/9e+mv8tk9s5jS52OnkGYDv43vkRUEU QEOm0BxJhaYD+ahPnGQ5jXyepyD+40Z5XQmedOnpQU6sYpIx9I9Fe/Z+uSWZw9Y+zLB8 O0t44N3NMlSyQ8qCeCevU/RDmf6K97bZESbZ7FkfU8ErpXVUWQXHhXULdjSyOvk66tJq NNzg==
- In-reply-to: <etPan.5aa22836.70671812.159ee@zdharma.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Sebastian Gniazdowski <psprint@xxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author