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

Re: Why sourcing a file is not faster than doing a loop with eval, zle -N

Parsing 10,000 lines, each a colon-command followed by misc. text, and
repeated 10 times.

HEAD from git:

Src/zsh -fs  0.31s user 1.24s system 94% cpu 1.634 total
Src/zsh -fs  0.45s user 1.31s system 98% cpu 1.795 total
Src/zsh -fs  0.39s user 1.41s system 95% cpu 1.877 total
Src/zsh -fs  0.31s user 1.16s system 88% cpu 1.652 total
Src/zsh -fs  0.43s user 1.33s system 94% cpu 1.854 total
Src/zsh -fs  0.43s user 1.22s system 92% cpu 1.784 total
Src/zsh -fs  0.37s user 1.32s system 91% cpu 1.848 total
Src/zsh -fs  0.31s user 1.48s system 91% cpu 1.948 total
Src/zsh -fs  0.42s user 1.37s system 92% cpu 1.926 total
Src/zsh -fs  0.30s user 1.52s system 92% cpu 1.964 total

Peter's patch:

Src/zsh -fs  0.11s user 0.59s system 73% cpu 0.953 total
Src/zsh -fs  0.10s user 0.54s system 68% cpu 0.940 total
Src/zsh -fs  0.17s user 0.56s system 71% cpu 1.017 total
Src/zsh -fs  0.19s user 0.58s system 79% cpu 0.969 total
Src/zsh -fs  0.13s user 0.65s system 74% cpu 1.040 total
Src/zsh -fs  0.05s user 0.65s system 74% cpu 0.945 total
Src/zsh -fs  0.19s user 0.64s system 82% cpu 1.009 total
Src/zsh -fs  0.18s user 0.59s system 81% cpu 0.944 total
Src/zsh -fs  0.34s user 0.47s system 80% cpu 1.002 total
Src/zsh -fs  0.35s user 0.52s system 89% cpu 0.971 total

My "simpler" patch:

Src/zsh -fs  0.17s user 0.79s system 85% cpu 1.119 total
Src/zsh -fs  0.28s user 0.77s system 90% cpu 1.160 total
Src/zsh -fs  0.19s user 0.82s system 88% cpu 1.146 total
Src/zsh -fs  0.20s user 0.70s system 82% cpu 1.087 total
Src/zsh -fs  0.20s user 0.65s system 84% cpu 1.011 total
Src/zsh -fs  0.31s user 0.57s system 86% cpu 1.021 total
Src/zsh -fs  0.22s user 0.72s system 81% cpu 1.148 total
Src/zsh -fs  0.21s user 0.60s system 81% cpu 0.999 total
Src/zsh -fs  0.19s user 0.63s system 78% cpu 1.046 total
Src/zsh -fs  0.23s user 0.81s system 83% cpu 1.242 total

The additional speedup in PWS's patch is probably due to fewer stdio
function calls, and skip of the check for buffer overflow on every
character read.

I don't think the HAVE_FGETS + configure change is needed, there are
already at least four places where we assume fgets() is available.

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