zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: Performance of _store_cache and _retrieve_cache
Date: Thu, 28 May 2015 00:10:08 +0200	[thread overview]
Message-ID: <13334.1432764608@thecus.kiddle.eu> (raw)
In-Reply-To: <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


  parent reply	other threads:[~2015-05-27 22:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-08 16:19 Daniel Hahler
2015-02-08 18:27 ` Daniel Hahler
2015-02-08 19:14 ` Bart Schaefer
2015-02-08 20:27 ` Bart Schaefer
2015-02-09  2:20   ` Slow parsing of large array assignments Bart Schaefer
2015-05-23  1:10   ` Regression with completion cache (was: Re: Performance of _store_cache and _retrieve_cache) Daniel Hahler
2015-05-27 22:10   ` Oliver Kiddle [this message]
2015-05-28 22:18     ` Performance of _store_cache and _retrieve_cache Bart Schaefer
2015-05-29 11:13       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13334.1432764608@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).