Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Optimizing (z)-flag
- X-seq: zsh-workers 44649
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: Optimizing (z)-flag
- Date: Sun, 11 Aug 2019 11:37:26 -0700
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aLZiYqou7HwZ7plcQ5Uvrewio7ZP94gzOa0eglQ6tHs=; b=oIF7j8fNJtv2DIOvjGyTyV/02eaBxLkcmcOO/SZb9/2rpS/a92yqrDi5mlyvD6mg5Q u6I5qmPmiVIg7+yZ0YD0cAJztHS3KHhguc40J6v5C4dAYxLUrPsyxVBthG3WKgEYbue8 a6uy3wamlN5KUdJTU140KKzOy5BPIsxhJ8vuHiOpJhAQCumzz00TReFsL8eoAyxu7C3r pd54RRIBLO8EK0l5uEX1pO4HSZYpBhO7vDwJu37bjMqqpNQ4Pvc2swkJLkF8MLUWE+GV 9qv2bFI17wilGl9Cd0EBCET+Kb0c4xe0qyOlV5mdm3HSwRdpR3sTkHZluJwOY6tGhWes 7LDQ==
- In-reply-to: <CAKc7PVDsoqFRB3m73ppmE2HqxT6kkUhDRHMWWp2OLdPK3VFFLw@mail.gmail.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>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVDsoqFRB3m73ppmE2HqxT6kkUhDRHMWWp2OLdPK3VFFLw@mail.gmail.com>
On Sun, Aug 11, 2019 at 11:21 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> 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.
You're going to want to look at bufferwords in Src/hist.c. If memory
allocation is the problem (of which I'm not convinced) it's probably
because the lexer discards some tokens while building the parse tree,
and bufferwords has to reconstruct the original text in some form,
which often means recopying the string values that the lexer does
return. I don't think it's got very much to do with actually managing
the array, other than in the generic sense that parameter expansions
are done by value rather than by reference and therefore the source
array is copied yet again during final substitution.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author