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

Brace expansion performance




Hi all,
does anybody know why the zsh brace expansion (?) performs so ... differently?

[1]

% time ksh -c 'echo ${.sh.version};for i in {1..300000}; do :;done'
Version JM 93t+ 2009-05-01
0.50s user 0.24s system 90% cpu 0.817 total

% time bash -c 'echo $BASH_VERSION;for i in {1..300000}; do :;done'
4.0.33(1)-release
1.59s user 0.58s system 90% cpu 2.409 total

% time zsh -c 'print $ZSH_VERSION $ZSH_PATCHLEVEL;for i in {1..300000}; do :;done'
4.3.10 1.4705
15.26s user 5.24s system 87% cpu 23.468 total

[2]

$ time ksh -c 'echo ${.sh.version};for i in {1..300000}; do :;done'
Version M 1993-12-28 r

real    0m0.886s
user    0m0.873s
sys     0m0.014s

$ time bash -c 'echo $BASH_VERSION;for i in {1..300000}; do :;done'
3.1.17(1)-release

real    0m2.482s
user    0m2.463s
sys     0m0.019s

$ time zsh -c 'print $ZSH_VERSION $ZSH_PATCHLEVEL;for i in {1..300000}; do :;done'
4.2.6

real    0m47.353s
user    0m46.672s
sys     0m0.629s

Tested on VirtualBox Ubuntu 9.10 guest [1] and on a real RHEL 5.1 host[2].


Best regards
Dimitre









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