Description
I have an application that uses HashTable IntSet _
(see https://gitlab.imn.htwk-leipzig.de/waldmann/fdaln/-/blob/master/DFA.hs for benchmark - concluding that HashTable is a good choice, and actual use case https://gitlab.imn.htwk-leipzig.de/waldmann/presburger-arithmetic )
I find that it spends quite some time in Data.HashMap.Internal.hash, evaluating (what I assume to be inlined)
instance Hashable IntSet.IntSet where
hashWithSalt salt x = IntSet.foldl' hashWithSalt
(hashWithSalt salt (IntSet.size x))
x
Can we do better here? If the IntSet is small, all the information is in (very few, often just one) Word64. The above implementation will unpack those - via Data.IntSet.Internals.fold'Bits which (I guess) is not fully inlined (it has a recursive go
function. In theory, that could be unrolled, then fused ...)
Well, such an instance must then go into containers
(not hashable
) since it accesses the internal representation?
I may find some time (or a student) to work on this but I wanted to get some general comment and input first.