d-segmented-hashmap 1.0.4

A segmented hash map/associative array/aa implementation for D which provides must faster table creation


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

d-segmented-hashmap

A segmented hash map implementation for D which provides must faster table creation

Implementatio: Almost implements every feature from D AA:

  • Stable location so, you can hold up any key/value elocation

Improvements over D AA

  • (Better for fire and forget) -> No rehash happens
  • Might use less memory, specially for strings as keys since the state is encoded on it
  • put is a much faster operation, almost tripling the speed of D AA
  • You can pre-initialize its capacity (reserve memory)

Cons:

  • A get operation with best case of O(1) and worst case of O(log n). Though it will never be O(n) since no rehash happens
  • After removing elements, other segmentations of the map will become unused. True removal can only be achieved when calling .clear()

Usage

import hip.util.shashmap;
HashMap!(string, string) map;
//map.setCapacity(50_000); //You may use that for reserving the size
foreach(i; 0..50000)
{
    map[identifiers[i]] = values[i];
}

foreach(string value; map)
{
    target = value;
}

string* myValue = "someKey" in map;
map.remove("someKey");

Authors:
  • Marcelo Silva Nascimento Mancini
Dependencies:
none
Versions:
1.0.4 2025-Aug-27
1.0.3 2025-Aug-26
1.0.2 2025-Aug-26
1.0.1 2025-Aug-26
1.0.0 2025-Aug-26
Show all 6 versions
Download Stats:
  • 2 downloads today

  • 64 downloads this week

  • 64 downloads this month

  • 64 downloads total

Score:
1.0
Short URL:
d-segmented-hashmap.dub.pm