Open jix opened 2 months ago
I've started implementing some of this, as I needed it for something else I was working on, but I still need to extract it into a separate branch to turn it into at least a WIP PR.
The PR #13 adds SetSeq
and IdSetSeq
.
PR #17 provides the order preserving types mentioned in the issue
We're using quite a few custom collection types, mostly
TableSeq
,IdVec
or collections built on top of them (likeIndexedIdVec
) or otherwise related toTableSeq
orId
types. I want to improve these in the following ways:TableSeq<T>
corresponds (usage wise) to aVec<HashTable<T>>
but many uses of it could be aVec<HashSet<T>>
orVec<HashMap<K, V>>
so adding aSetSeq<T>
andMapSeq<K, V>
makes sense.TableSeq<T>
(or futureSetSeq<T>
andMapSeq<K, V>
) is theid_index()
of anId
type, soId{Table,Set,Map}Seq
types would be usefulVar
but allow insertion and querying using aLit
, automatically applying Boolean negation to the stored values as appropriate. This requires some currently missing traits to classify which types support Boolean negation (see also #7)indexmap
crate offers, but more memory efficientindexmap
always uses a hashtable of 64-bit indices and caches the 64-bit hash value for all entries, that ends up using almost 3x as much memory as needed in most of our use casesIndexedIdSet<u32, T>
is essentially what this should be, but that doesn't have a great API for this use case because it also wants to be a map type withu32
keysVar
/Lit
, it should beIndexedIdSet<u64, T>
instead ofIndexedIdSet<u32, T>