Speed of hash tables compared to lua

Steven Schveighoffer schveiguy at gmail.com
Sun Sep 13 21:29:53 UTC 2020


On 9/13/20 4:50 PM, Daniel Kozak wrote:
> 
> 
> On Sun, Sep 13, 2020 at 1:25 PM ikod via Digitalmars-d 
> <digitalmars-d at puremagic.com <mailto:digitalmars-d at puremagic.com>> wrote:
> 
> 
>     Default runtime map provide some properties which may be
>     unavailable for other implementations. Its speed may be affected
>     by GC, it uses to keep table items.
> 
>     You may include some hash map implementations from the dub repo
>     in your benchmark.
> 
> 
> I have tried emsi_containers, memutils and  ikod-containers.
> default D's AA take 1s on my pc
> emsi_containers take 3s realy slow
> memutils was fast but does not realy work (seems it is broken because 
> there has been nan at d[0] and many  other indexes)
> ikod-containers take 242ms
> 

The allocation patterns definitely affect the builtin containers. A long 
time ago, dcollections kicked the pants off of builtin AAs for most 
patterns, basically by using different memory allocation strategies (for 
example, allocating blocks of elements at a time, and using C malloc 
when no pointers were detected in the type).

Builtin AA's will always have to be slower, because they must allocate a 
separate piece of memory for each bucket to retain the property that you 
can get a pointer to any element, and that memory will survive anything 
the AA can do.

-Steve


More information about the Digitalmars-d mailing list