Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Performance tests of quoting and dequoting, printf -v turned out slow



On 9 marca 2018 at 15:53:52, Stephane Chazelas (stephane.chazelas@xxxxxxxxx) wrote:
> 2018-03-09 14:39:10 +0100, Sebastian Gniazdowski:
> [...]
> > 5.3.1, I looked also at 5.4.2 and the results were the same.
> > For your snippets I get the same results as you. If I source
> > short.zsh, I again get ~25 sec time. I will find some time to
> > narrow this shortly.
> [...]
> 
> Maybe a heavy (that forks for instance) "DEBUG" trap?
> 
> or a wrapper function around "printf"?

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.

-- 
Sebastian Gniazdowski
psprint /at/ zdharma.org



Messages sorted by: Reverse Date, Date, Thread, Author