From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Hartwig Newsgroups: gmane.lisp.guile.devel Subject: Re: Growable arrays? Date: Fri, 15 Jun 2012 01:23:16 +0800 Message-ID: References: <87hauku0mb.fsf@fencepost.gnu.org> <87sjdyyncv.fsf@netris.org> <87vciuuf12.fsf@fencepost.gnu.org> <87k3z9vrds.fsf@fencepost.gnu.org> <87fw9xvmq4.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1339694616 7607 80.91.229.3 (14 Jun 2012 17:23:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 14 Jun 2012 17:23:36 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jun 14 19:23:36 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SfDld-0000o1-OB for guile-devel@m.gmane.org; Thu, 14 Jun 2012 19:23:33 +0200 Original-Received: from localhost ([::1]:54045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfDld-0000tM-F4 for guile-devel@m.gmane.org; Thu, 14 Jun 2012 13:23:33 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfDlW-0000st-8A for guile-devel@gnu.org; Thu, 14 Jun 2012 13:23:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfDlO-0008Uc-RN for guile-devel@gnu.org; Thu, 14 Jun 2012 13:23:25 -0400 Original-Received: from mail-yw0-f41.google.com ([209.85.213.41]:55687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfDlO-0008UF-LI for guile-devel@gnu.org; Thu, 14 Jun 2012 13:23:18 -0400 Original-Received: by yhr47 with SMTP id 47so2027537yhr.0 for ; Thu, 14 Jun 2012 10:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=2W5mNVAkTkx14OCMlqFtiXvcnrboIX2p/fc8ZnPoC+0=; b=irbJLneG5pVTDWoUC2+isMwrLaLTc6ol+oDEbQoNk8cXJBqlhWtIdizH2Uf42Ov+Sy i4OTuBhOt9cMVk2AyflGNGrfp3SAsdfZd0WFDe/6TaT/z1rbE3MhA4kBXl8SUV7PwgBr na90sqcxkL5YlFx7VPcToxuSi6/UZg+JaDL3xifXheMEQEBJ47qXiM6am0/SCJnpGflg QvndEaeKboDQZnkytsrD4jtAInYnzft5BnPKL52nZguvOpyx2iW8XOxM3jGOq9Q+a7on vVc0Cvi5O69xywrv93A7uiOwU+62b+ZdMPAug3hmeQg3XHSzxB4MvNsuovqzgTgbP85Y Pz6g== Original-Received: by 10.50.104.167 with SMTP id gf7mr13311592igb.38.1339694596693; Thu, 14 Jun 2012 10:23:16 -0700 (PDT) Original-Received: by 10.231.206.198 with HTTP; Thu, 14 Jun 2012 10:23:16 -0700 (PDT) In-Reply-To: <87fw9xvmq4.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.41 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:14625 Archived-At: On 15 June 2012 01:15, David Kastrup wrote: > Daniel Hartwig writes: >> What is this half-in-place algorithm that makes this efficient? =C2=A0If >> the table is to remain balanced, all items should be rehashed and >> reallocated to a new bucket and there is no correlation between an >> items old and new buckets (hash). > > Huh? =C2=A0Hashing computes a hash value, and the bucket is determined by > hash % vectorsize. =C2=A0Double the vector size, and the new bucket locat= ions > are at bucket and bucket+vectorsize, so you need to coalesce the bucket > at bucket into the buckets at bucket and bucket+vectorsize. > > Why would there be no correlation between old and new buckets when they > are calculated based on the same hash code? =E2=80=A6 I see. So starting from the old tail there is little contention for the new buckets. This seems obvious now in hindsight :-) Regarding the data type for your application, this is something which needs to be accessible from the c side also?