zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: accessing array by index very slow
Date: Sun, 16 Apr 2023 11:19:49 +0200	[thread overview]
Message-ID: <CAKc7PVAgXMCoFKgVu4Wy=43C=NpC3zECPLirX9O9y1m7QCAY4A@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMouxgQNP=sfrXDhvtUkgLZgkDd6Z3GZX04rHGOhDwihpg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

There was badarrays branch from Mikachu in the past. it was resolving
constant arrlen() calling.

niedz., 16 kwi 2023, 11:10 użytkownik Roman Perepelitsa <
roman.perepelitsa@gmail.com> napisał:

> On Sun, Apr 16, 2023 at 11:04 AM Stephane Chazelas
> <stephane@chazelas.org> wrote:
> >
> > Accessing array elements via their index is very slow,
> > especially for large index values.
>
> Indeed, access to array elements is O(N) in zsh instead of O(1) that
> one might expect. The same goes for strings, even with no_multibyte.
> This makes computation-heavy code incredibly slow. If someone can fix
> this, they'll have my eternal gratitude.
>
> On the plus side zsh has fast hashtables (closed hashing with
> quadratic probing). Bash's implementation is a lot slower (it's
> node-based).
>
> Roman.
>
>

[-- Attachment #2: Type: text/html, Size: 1232 bytes --]

  reply	other threads:[~2023-04-16  9:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-16  9:03 Stephane Chazelas
2023-04-16  9:10 ` Roman Perepelitsa
2023-04-16  9:19   ` Sebastian Gniazdowski [this message]
2023-04-16 15:27     ` Bart Schaefer
2023-04-16 22:03       ` Mikael Magnusson
2023-04-18  2:43         ` Bart Schaefer
2023-04-30 19:26           ` Bart Schaefer

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='CAKc7PVAgXMCoFKgVu4Wy=43C=NpC3zECPLirX9O9y1m7QCAY4A@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --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).