You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StringMap is good for specific use cases where you need to map data to strings but works poorly in many smaller cases or cases where you want to map non-strings to data. Iterating requires creating a StringMapSnapshot [which could fail in creation] in order to iterate its data and even wanting to iterate a specific piece of data requires creating a StringMapSnapshot. This isn't even mentioning that you need to delete each StringMapSnapshot after creation.
Given this, there is no proper way to store insertion order without requiring something like an ArrayList. Normally this wouldn't be an issue except in cases where you want to iterate by key, in order.
Iterating the keys in order is very difficult, even with an ArrayList since ArrayList can't store variable-length blocks of strings [strings have to be a certain width as given the block size on constructor]. string keys need their length and data tracked which feasibly would require something like an "ArrayListBlock" where you'd have a pool of ArrayLists with blocks of power of 2, basically like a buddy memory allocator but with ArrayLists.
Based on my previous work with OrdMap [obsolete by my personal standards], I am proposing to create a specially designed general-purpose, cache-friendly, type-safe, performant, and naturally-ordered hash table implementation.
the hash table I'm proposing will have the following qualities:
can search by [str/arr/cell] key or index:
any data = htab.GetValueByStrKey("test");
data = htab.GetValueByCellKey(10);
data = htab.GetValueByArrayKey({ 1,2,3 }, 3);
int len = htab.Len;
for( int i; i < len; i++ ) {
any data = htab.GetValueByIndex(i);
}
keys and values are typed and their types can be retrieved for runtime inspection note: the names just a proof of concept, not their planned names.
likewise, values can be removed either by [str/arr/cell] key or by index.
The text was updated successfully, but these errors were encountered:
assyrianic
changed the title
[Feature Request] deprecate StringMap and replace with ordered, cache-friendly, general-purpose Hashtable
[Feature Request] deprecate StringMap and add ordered, cache-friendly, general-purpose Hashtable
Aug 17, 2023
assyrianic
changed the title
[Feature Request] deprecate StringMap and add ordered, cache-friendly, general-purpose Hashtable
[Feature Request] add ordered, cache-friendly, general-purpose Hashtable
Aug 17, 2023
Help us help you
Description
StringMap
is good for specific use cases where you need to map data to strings but works poorly in many smaller cases or cases where you want to map non-strings to data. Iterating requires creating aStringMapSnapshot
[which could fail in creation] in order to iterate its data and even wanting to iterate a specific piece of data requires creating aStringMapSnapshot
. This isn't even mentioning that you need to delete eachStringMapSnapshot
after creation.Given this, there is no proper way to store insertion order without requiring something like an
ArrayList
. Normally this wouldn't be an issue except in cases where you want to iterate by key, in order.Iterating the keys in order is very difficult, even with an
ArrayList
sinceArrayList
can't store variable-length blocks of strings [strings have to be a certain width as given the block size on constructor].string
keys need their length and data tracked which feasibly would require something like an"ArrayListBlock"
where you'd have a pool ofArrayList
s with blocks of power of 2, basically like a buddy memory allocator but withArrayList
s.Based on my previous work with
OrdMap
[obsolete by my personal standards], I am proposing to create a specially designed general-purpose, cache-friendly, type-safe, performant, and naturally-ordered hash table implementation.the hash table I'm proposing will have the following qualities:
The text was updated successfully, but these errors were encountered: