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 Sat, Mar 10, 2018 at 7:40 AM, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
>
> What may affect things is whether or not zsh was built to use
> open_memstream from libc. FreeBSD and GNU libc have open_memstream.

Indeed:

schaefer[556] Src/zsh -f
% qflag() {
    local OUTPUT
    repeat 10000; do
        OUTPUT="${(q)INPUT}"
    done
}
% typeset -F SECONDS=0; qflag; print $SECONDS
0.0282280000
% prtf() {
    local OUTPUT
    repeat 10000; do
        printf -v OUTPUT '%q ' "$INPUT"
    done
}
% typeset -F SECONDS=0; prtf; print $SECONDS
3.8363050000
%

schaefer[557] grep -i memstream config.h
/* Define to 1 if you have the `open_memstream' function. */
/* #undef HAVE_OPEN_MEMSTREAM */



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