Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16202

Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?)

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From George Jones <fooologist@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?)
Date Mon, 20 Apr 2020 17:12:28 -0400
Lines 50
Approved bug-bash@gnu.org
Message-ID <mailman.834.1587417171.3066.bug-bash@gnu.org> (permalink)
References <CALv3B7aiTbhpyUL17Eg5prH39EgMP8uSDdD554OdND3LFETAQg@mail.gmail.com> <CAFLRLk8ydO6ev8wRcJ35kzzN3Yt2_9sjsc6L+C0CC6dCxud_NA@mail.gmail.com> <CALv3B7bzh3degKPCe5c_avUc90L+bE8jqKKcaVo13zwqEyB5-A@mail.gmail.com> <CAFLRLk-XAU3rrRHy1wWdY7Py-gkLaU-UfiPc47MOEA8eutYx1A@mail.gmail.com> <20200420124911.GW845@eeg.ccf.org> <a351bc16-182b-b2e9-319d-e9d1615f209a@case.edu> <CAFLRLk_KetD6+-o2HOdP6ueKuynu_7Yn6ARZ_HbC4QC=99-WcA@mail.gmail.com> <CALv3B7YTnS8R8D=dYbbOUFROOvhSQ1gfc_ETT+cikp3onBMR1A@mail.gmail.com> <61c51c64-d17e-6ea0-6ace-0c3365ef2299@case.edu> <CALv3B7Yrg7bDO0eViSTBWad56vw_dGnnXtMRa9ofYysiAiYJbA@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1587417171 16979 209.51.188.17 (20 Apr 2020 21:12:51 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Koichi Murase <myoga.murase@gmail.com>, bug-bash@gnu.org
To Chester Ramey <chet.ramey@case.edu>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7TG9fMtQsWSzgd1BtQdntB9UcyZgvbsRm7OV1tPIh+8=; b=I+oka24v2qYyOFQvfDbyC1c2nklhNfjUHt5g67kelHM7OkLMcZ0HKZOQoYspFkna3C Rql4KWghGMNWvvKw1tFnyS3UK8957SHWvjqXt17EYW4SH2cMVL2QqkqH5VlriGoxMYSS vV+1YFHxB/igJe25uD6XpA0UKnJH64xSGpMw6laQc/VaxcwZ6dXd5Mbr8AclUz9LAtls bBAPYFZjqIvq8zeXKLaw+rjsWdQfuMZQI+PZiJ+zOlfdmk/gs9Eu4pQf92PSpSte6RnZ KTyihdSwHRaBVUK4GwQLsx0C9kRazyoIaIVNYNu8D0otvskJQIurO1UG9cetA7KjSUmW adyg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7TG9fMtQsWSzgd1BtQdntB9UcyZgvbsRm7OV1tPIh+8=; b=ecUIUn+okRfoxiPqMTlez5/2uNyoe8VUbIXJVDuuS824NHae31X4O2gADcWXIlgT+7 O0GGFb8Xk93IEDc33d43fc31M6BfZXfEjpEepizAZJQVqufk3EifxHBozq58nIiYGwXo kfNmBg74pY4+21Nj8o1XTWmSdSLgR49U+3ZwBwFOv+lA7vSysB9b4h7sEZknCo/GHyGa 7WzR3wMM97TsrJ/j1ujtVtrxlOSLniiIZO+vzsxgznAFmZFhFlRhQxN9wII72t9O9aPl MMYPI56GD1scp0xC2wxaSZdBYZ0PAFCyti0v4hz3zK8NkRaB7DnWaoyejp8xa1mcFHds 0lHg==
X-Gm-Message-State AGi0PuYCmFdeZsiyCA4T9uedyC9M38AXvQhzbUeEJ9nY+ujyiBDD11B5 7ET2JA0Qolb87hj24Ck8+mvInj8qb8zvqQXsevo=
X-Google-Smtp-Source APiQypL+X6FTyefpiFqIRItapMM1+qXDR8+Iap3p0PT/5M6g7wkO2JqGxKr0nQNNHzRGhGnhUPfocLoXRYAiOCggEmo=
X-Received by 2002:aca:3284:: with SMTP id y126mr924955oiy.175.1587417160175; Mon, 20 Apr 2020 14:12:40 -0700 (PDT)
In-Reply-To <61c51c64-d17e-6ea0-6ace-0c3365ef2299@case.edu>
Received-SPF pass client-ip=2607:f8b0:4864:20::244; envelope-from=fooologist@gmail.com; helo=mail-oi1-x244.google.com
X-detected-operating-system by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67
X-Received-From 2607:f8b0:4864:20::244
X-Content-Filtered-By Mailman/MimeDel 2.1.23
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CALv3B7Yrg7bDO0eViSTBWad56vw_dGnnXtMRa9ofYysiAiYJbA@mail.gmail.com>
X-Mailman-Original-References <CALv3B7aiTbhpyUL17Eg5prH39EgMP8uSDdD554OdND3LFETAQg@mail.gmail.com> <CAFLRLk8ydO6ev8wRcJ35kzzN3Yt2_9sjsc6L+C0CC6dCxud_NA@mail.gmail.com> <CALv3B7bzh3degKPCe5c_avUc90L+bE8jqKKcaVo13zwqEyB5-A@mail.gmail.com> <CAFLRLk-XAU3rrRHy1wWdY7Py-gkLaU-UfiPc47MOEA8eutYx1A@mail.gmail.com> <20200420124911.GW845@eeg.ccf.org> <a351bc16-182b-b2e9-319d-e9d1615f209a@case.edu> <CAFLRLk_KetD6+-o2HOdP6ueKuynu_7Yn6ARZ_HbC4QC=99-WcA@mail.gmail.com> <CALv3B7YTnS8R8D=dYbbOUFROOvhSQ1gfc_ETT+cikp3onBMR1A@mail.gmail.com> <61c51c64-d17e-6ea0-6ace-0c3365ef2299@case.edu>
Xref csiph.com gnu.bash.bug:16202

Show key headers only | View raw


No real opinion on syntax.

Using something existing:

    declare -A foo[SIZE]

seems sensible, especially if there was no semantic meaning (I'm not a fan
of syntax without semantics .... clutter).

Big thing is that the new stuff for fringe new pathologic use cases (mine)
should not have negative impact (huge buffer preallocation) on the existing
?30 years? of users/scripts.

Some docs on how the SIZE is used (hint for preallocation of hash table
size, not hard limit on number of entries) probably also in order.

Thanks,
---george jones


On Mon, Apr 20, 2020, 4:23 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 4/20/20 11:16 AM, George Jones wrote:
> > No problem.   Glad you fixed it.   It's been a LONG time since I've
> > actually written C, so probably best if someone current did it.
> >
> > On the parameters, I suggest you consider exposing the at user level as a
> > switch or env var.   My use case was pathologically large (and would have
> > been better on, e.g. Spark if that were and option in the environment).
> >  Even the old behavior was probably good enough for most people.  It's
> only
> > when you start abusing bash to to "big data" that the problem shows up.
>
> I've been considering how to provide a way to let users indicate the size
> of an array when they declare it. `declare' accepts `declare -a name[size]'
> and `declare -A name[size]' for compatibility with ksh, but has never done
> anything with `size'.
>
> I could see allowing a number, or maybe an arithmetic expression, for SIZE
> to set the initial size of an associative array. Or maybe an additional
> option to `declare' would work better. I don't like using a shell variable
> for this.
>
> What does the group think?
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?) George Jones <fooologist@gmail.com> - 2020-04-20 17:12 -0400

csiph-web