Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Performance of _store_cache and _retrieve_cache
- X-seq: zsh-workers 35310
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: "Zsh Hackers' List" <zsh-workers@xxxxxxx>
- Subject: Re: Performance of _store_cache and _retrieve_cache
- Date: Thu, 28 May 2015 00:10:08 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1432764610; bh=0Alwu20XWswuiJ++zJ/0FSWTYzHmeHE6tdmrt3M1nS8=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=uWyGlpl+ufS5W4h91e9oMdyIzJJEYctKUsGJro+BXvECjza4U2khjYWurLKPudyxEQbHScHYtmJ6pJpxKHxM52cRDCE7vai7Tpy30VQ7DVwkKB3X2H0c8lCTeYnfqNwo/tNTgFYpfXbO1Yc1ZQSJ755cUdwJyKH/T8Dt6QyurKWU2vVfr1/btl38MJ68MMgTHyp8IJqaxqge3DbHOpnbEDbylVFNTgkJ+cy5uPcnsVMRTSzxI6dnojKkibDf5Hao03lMBYtowRJC8Z6khuUV+3W+3lv4u0lyLkpI4f1Ugc90hPOFhlUtSD/r4XKIrg/Nhg65TQXhXguzWROKrngREQ==
- In-reply-to: <150208122744.ZM5447@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <54D78CA8.7010802@thequod.de> <150208122744.ZM5447@torch.brasslantern.com>
On 8 Feb, Bart wrote:
> _zsh_all_pkgs=( "${(zQ)$(<<\EO:_zsh_all_pkgs
> '02exercicio' '0x10c-asm' ...
> EO:_zsh_all_pkgs
> )}" )
This is removing the quotes before doing the word splitting so breaks
if there are values that need quoting. It works with another level of
nesting as in the patch below. I timed some tests and this is still much
faster than the original given a large enough array.
For a good example of this failing, set the extra-verbose style and do
command completion. Note that you'll only see problems when
_command_descriptions is loaded from the cache.
Oliver
diff --git a/Completion/Base/Utility/_store_cache b/Completion/Base/Utility/_store_cache
index 8feaee6..fb2ab32 100644
--- a/Completion/Base/Utility/_store_cache
+++ b/Completion/Base/Utility/_store_cache
@@ -49,10 +49,10 @@ if zstyle -t ":completion:${curcontext}:" use-cache; then
(*(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 "$var=( "'${(Q)"${(z)$(<<\EO:'"$var"
print -r "${(kv@Pqq)^^var}"
print -r "EO:$var"
- print -r ')}" )'
+ print -r ')}"} )'
;;
(*) print -r "$var=${(Pqq)^^var}";;
esac
Messages sorted by:
Reverse Date,
Date,
Thread,
Author