Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Optimizing (z)-flag
- X-seq: zsh-workers 44648
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Optimizing (z)-flag
- Date: Sun, 11 Aug 2019 20:20:16 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=lzRqbxmBoSW7FuKpSlNR6P0riQd9WQuVm2G75vAIe4Y=; b=j6MvInZAhkPTwuJRChm4R6fpQSZhiStoPtlQUCArfi34agUrLM4SPFmiBNrJUU3PLR svfShPd+Ksc5vRlOJ73RFXF7KMF/BEiIeJz0oB3dpBdtq1pwT/xwuSaQLduD0nV1qtuT ruFXBJmtCIbQ5FAuy7TOdEpRjgunu3GHLp6/uMLJqjkUSgAyb8q8Mu4DuzjwIcxOvRe9 L/I4nx+SvrGGvDQnGn6BbyFFqfXZcKzRT3molMMQuEjYTChi1ClVYjrgTRG/kVDwdlec vuGDQUnrVqS13eBhem1QhOBEcZpeteKA0KZBikMDE3wc/XsrFF9+x6ljeCrTRJgPUlZq 1oAw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Hello,
I'm thinking: why the (z) flag runs significantly slower that a zsh
executing the same script / text? It points that the cause should be
the way that (z) stores resulting elements. I suspect that it in
general doesn't use realloc() to extend the destination array but
instead some kind of allocate new larger buffer / copy / free the
previous buffer. So the possible optimization could be to use realloc,
a method that has already been proven, as it is used when appending to
arrays.
Am I right? Where is the code of (z) flag aggregating the resulting
elements located? It's hard to find as it's somewhere between the
lex.c and subst.c.
The advantages of providing such optimization would span over e.g.
syntax-highlighting plugins.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author