Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Slowdown around 5.0.5-dev-0
- X-seq: zsh-workers 36825
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Slowdown around 5.0.5-dev-0
- Date: Sat, 10 Oct 2015 20:32:45 +0200
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=AyBXET/ON0QYiuGZ6rL5WWSobtVFQ9zx4rcXA2+fQvc=; b=FWNaZ2AwPjqS8ITewkehTOoYkk+TGtRNpkR/N9eqHg+NXP7Czcvrt1nBu11NxyX1ho C5rrC75opBQ8VkaC3+5ro0HmSqtqDvvJek70RdG0vpbcel9LV+cnbtFbSUJaFfVXZ03Z vdggI1EFgPXYA2DN91gkYV2Nu1PxA2lLeC3LCeTFmd+P4PCA4H46NIdsXdo36aUisDSE WY6MZ8J8mLu0n5CNoYMwy9itMcx5TN1icIlzHSGWJQuRwON6n9Iquf1DnoJpEe4bZIAf Cc9T7D58X4yqugsjbqKaSbJg5pfl6fsBrW/Gig18oKB5AC3gLJoMYCHyv4N8N6I64piB u8Hg==
- In-reply-to: <CAKc7PVCvfEk2x6JmXwVLM3BWJw6FUZK-M5qkAMqW=xQ=zhAShQ@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>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVDAS+yud1ChCsAMMKqNF=vEPcbN51czm56veKcS3WZxyg@mail.gmail.com> <151010105849.ZM10144@torch.brasslantern.com> <CAKc7PVCvfEk2x6JmXwVLM3BWJw6FUZK-M5qkAMqW=xQ=zhAShQ@mail.gmail.com>
As for the code, it's interesting that it is just existence of large
array that slows down things. Just before spotting the >=5.0.5
slowdown I wrote an optimization:
if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then
prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN"
disp_list=(
"${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" )
fi
It creates a small array disp_list that is used for display. 23
elements in my case. The large 89k array "sleeps" waiting for change
of page or some other trigger (details not important). The patch
helped for 5.0.2 (except the possible temporal "dig" into slowness)
but for >= 5.0.5 it helps just a little, while it should help
completely, as everything is around 23 elements long array.
Best regards,
Sebastian Gniazdowski
On 10 October 2015 at 20:11, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> On 10 October 2015 at 19:58, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>> On the other hand the shell really isn't intended to be manipulating
>> arrays of containing tens of thousands of elements.
>
> I was afraid that this will be stated, by you as the author of the
> patch. It's just such a great thing that patterns are so fast, faster
> than regular expressions (from zsh/regex). And that they are so
> advanced. I can do fancy things like filtering for multiple words with
> *foo*~^*bar*, colorizing output by using (#m) which is faster than
> (#b) and provided for someone aware to utilize that gain and
> functionality. What I mean is that we shouldn't now slip into "shell
> isn't for that, anyway" after providing so much.
>
> PS. Not everything is so great, I was successfully optimizing my code
> by changing if[] into [] && || in crucial places. Removing variables
> as even a single assignment seems to cost much. But overall there's
> plenty in speed and functionality.
>
> Best regards,
> Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author