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


Groups > gnu.bash.bug > #16184

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 Koichi Murase <myoga.murase@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?)
Date Mon, 20 Apr 2020 18:48:44 +0900
Lines 92
Approved bug-bash@gnu.org
Message-ID <mailman.774.1587376155.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>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type multipart/mixed; boundary="000000000000b2977505a3b5ce97"
X-Trace usenet.stanford.edu 1587376156 25277 209.51.188.17 (20 Apr 2020 09:49:16 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To George Jones <fooologist@gmail.com>
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=rybR0ri+P2tFVBSkwjZVLgqFb9RdCUjDbyQl57LZekQ=; b=jgAdJuf9QkkZ10qFVJFfFeuCWFTwyGZw1/4Yu9A+6KsMitO5ukTwFusg8a0OUryuVb O44slEqHjCadyPsNK/wbu2SS8RclRlcjsJ3pVsGS39h53i4l8mQeEJTTRjTXMVFXzg4i 1MRb1WFrJ2MfY/mLhwuvT7uu78gSPLHVDuXOChcRHxpz8Ql+Ct4kDWkvP/BLrbkSwMXn D6oSgXZ9Tg1yHm9sM82R9mcEJvWxlaGCPp4FJoCnA06GM0DGJrGmIi9+cew+bbjnHlJP 86k7WVkIgVu9G6p6yiuAETa3l8+q5tgUnxfaNmeE7VLywVcGrLobDDOY5ehsPG/yJ0T+ SWbQ==
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=rybR0ri+P2tFVBSkwjZVLgqFb9RdCUjDbyQl57LZekQ=; b=OpOl/R6ENffDRY+ZxpPW0YGUFjstC1HNIRIArV0lWdZiVrUuv3ZYNGGWOvAVQnV4hH ghso7xJDI0qWkpaGic3QKGnrPrwOCbGMXVf4/s9HIO3wjQHXNkG9Mp5Ik3CYFF+zJADD ivGwsfVjYZy9aXQfJVykJ82PRxVsGLlFzf+IJTKcXtHMUVa3tJH4jfqukzK1AMh6Il4J 2Ksvewa92f0cYSwW3It5jH0p3MbVUUiJKJXlsEbagS7jnnJEA2wpc7Xa/8UAZ0t6X8lM ThauQF1jm8y3P2RIyMQ3uJtbIIo2kt+IkjpW6GekblIGouDH/Eq2HMZHgUDgtAxqaor2 CQ4g==
X-Gm-Message-State AGi0Puar3RlpKjNVGrFwRA6JlEGxW7Xf86WiDPKHRtyUDN39Y1qLhHNJ VMDGaGhX7/gjB2nft9Vc1mZX8CUco+9lWhUKB68=
X-Google-Smtp-Source APiQypK5VmhjH8jfvGpLhkjwF5bWBmEC7tNv6EQdtpz60J865J3fcdCxuCu0XDLGYmVW9t3gBOY8z8atYkcuvtUpCqY=
X-Received by 2002:a2e:95d2:: with SMTP id y18mr5219656ljh.65.1587376135749; Mon, 20 Apr 2020 02:48:55 -0700 (PDT)
In-Reply-To <CALv3B7bzh3degKPCe5c_avUc90L+bE8jqKKcaVo13zwqEyB5-A@mail.gmail.com>
Received-SPF pass client-ip=2a00:1450:4864:20::242; envelope-from=myoga.murase@gmail.com; helo=mail-lj1-x242.google.com
X-detected-operating-system by eggs1p.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67
X-Received-From 2a00:1450:4864:20::242
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 <CAFLRLk-XAU3rrRHy1wWdY7Py-gkLaU-UfiPc47MOEA8eutYx1A@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>
Xref csiph.com gnu.bash.bug:16184

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

2020-04-20 10:00 George Jones <fooologist@gmail.com>:
> Thank you.  Patch applied and (performance) tested with come tests
> I was working on
> https://github.com/eludom/snippits/tree/master/bash/tests
> .... bottom line:

Thank you for the measurements.

Also, I am sorry that I disturbed your plan for contributing to Bash.
I actually initially doubted that the insertion with the current
implementation is O(N), so I created the test first and then found
that it is an easy fix rather than reimplementing it by B-tree or
other data structures.  I couldn't stop my interest in how much it is
improved by the easy fix.

Nevertheless, I have not tuned the parameters of rehashing.  Actually
it is a tradeoff between the memory consumption and the computational
time, so it is a matter of preference to some extent.  I attach an
updated patch which exposes some parameters.  If you have an interest,
you can play by changing the value of the parameters
`HASH_REHASH_MULTIPLIER' and `HASH_MAX_LOADFACTOR' defined in
`hashlib.h'.

--
Koichi

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


Thread

Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?) Koichi Murase <myoga.murase@gmail.com> - 2020-04-20 18:48 +0900

csiph-web