1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-07 09:21:18 +02:00

34476: change _store_cache assignment format

Avoids potentially expensive lexical analysis of the array values.
This commit is contained in:
Barton E. Schaefer 2015-02-12 09:31:09 -08:00
parent 7398fea059
commit ae7dcab5ed
2 changed files with 13 additions and 2 deletions

View file

@ -4,6 +4,10 @@
Back out 34485, an alternate solution needs to be worked Back out 34485, an alternate solution needs to be worked
out. (Tweaked to keep the unrelated hunk of the E01 test.) out. (Tweaked to keep the unrelated hunk of the E01 test.)
* 34476: Completion/Base/Utility/_store_cache: change the
assignment format to avoid potentially expensive lexical
analysis of the array values
2015-02-11 Peter Stephenson <p.stephenson@samsung.com> 2015-02-11 Peter Stephenson <p.stephenson@samsung.com>
* users/19850: Doc/Zsh/params.yo, Src/watch.c: watch variable * users/19850: Doc/Zsh/params.yo, Src/watch.c: watch variable

View file

@ -46,7 +46,14 @@ if zstyle -t ":completion:${curcontext}:" use-cache; then
for var; do for var; do
case ${(Pt)var} in case ${(Pt)var} in
(*readonly*) ;; (*readonly*) ;;
(*(association|array)*) print -r "$var=( ${(kv@Pqq)^^var} )";; (*(association|array)*)
# Dump the array as a here-document to reduce parsing overhead
# when reloading the cache with "source" from _retrieve_cache
print -r "$var=( "'"${(zQ)$(<<\EO:'"$var"
print -r "${(kv@Pqq)^^var}"
print -r "EO:$var"
print -r ')}" )'
;;
(*) print -r "$var=${(Pqq)^^var}";; (*) print -r "$var=${(Pqq)^^var}";;
esac esac
done >! "$_cache_dir/$_cache_ident" done >! "$_cache_dir/$_cache_ident"