bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Chet Ramey
Subject: Re: [PATCH] Implement rehashing for associative arrays (Re: speeding up hash_search?)
Date: Mon, 20 Apr 2020 11:57:20 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 4/19/20 3:51 PM, Koichi Murase wrote:

> 
> The associative arrays in `hashlib.c' are implemented by hash tables
> as is clear from its name.  The main lookup of hash table algorithm is
> done by the following line
> 
>   bucket = HASH_BUCKET (string, table, hv);
> 
> but not by the subsequent linear search.  The linear search is just a
> workaround for the collision of hashes.  As far as the load factor of
> the hash table is maintained properly, the linear search is O(1)
> because the length of the list is O(1).
> 
> 2020-04-19 23:54 George Jones <fooologist@gmail.com>:
>> This slows down (order N?) new inserts when the number of entries
>> gets large.
> 
> I looked into `hashlib.c' and found that rehashing is actually not
> implemented.  I just added a function to perform rehashing, and
> the performance has been improved.

Thanks for the patch. This will be in the next devel branch push.

Chet

-- 
``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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]