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

One glob (*cbp) slow, other (*1000) fast, why?



Hello,
on a directory with 80000 files (result of touch {1..2000} {1..2000}{a..c})
I do:

typeset -F SECONDS; myst=$SECONDS; tmp=( *cbp(NY1) ); echo $(( (SECONDS -
myst) * 1000 ))

it returns: 80.449999999927968

then I do:

typeset -F SECONDS; myst=$SECONDS; tmp=( *1000(NY1) ); echo $(( (SECONDS -
myst) * 1000 ))

it returns: 0.15299999995477265

Why such a difference?


More:

typeset -F SECONDS; myst=$SECONDS; tmp=( *10000(NY1) ); echo $(( (SECONDS -
myst) * 1000 ))
0.2779999999802385
typeset -F SECONDS; myst=$SECONDS; tmp=( *100000(NY1) ); echo $(( (SECONDS
- myst) * 1000 ))
78.060000000277796

I.e. it starts to be slow at 5 or more zeros.

Best regards,
Sebastian Gniazdowski


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