bug-bash
[Top][All Lists]
Advanced

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

Re: speeding up hash_search?


From: Chet Ramey
Subject: Re: speeding up hash_search?
Date: Sun, 19 Apr 2020 15:46:26 -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 10:53 AM, George Jones wrote:
> It looks like hash_search just does a linear walk if array entries to find
> elements in a list.   This slows down (order N?) new inserts when the
> number of entries gets large.

Well, that's the collision handling mechanism. You have to have one. If the
hash table is sized right -- and it's entirely possible that the default
size of the hash table for associative arrays is too small for your use
case -- it's not much overhead.

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]