-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better instance Hashable IntSet? #269
Comments
You are correct, the current implementation doesn't dig into internals of It's probably possible to be more efficient if But such |
Yes, we definitely should do something custom. Where it belongs is going to be awkward. There are two good options I see.
Things have been really crazy for me the last couple weeks, so I can't guarantee I'll be able to get (1) done as soon as you might like, but I'll try. |
This is not much better than having
On the other hand https://hackage.haskell.org/package/containers-0.6.7/docs/Data-IntSet-Internal.html#t:IntSet is completely undocumented. I have no idea how to I would start, so I repeat: having versioned internals won't do it alone, unless they are properly documented so they can be actually used by non- There is precedence for "Expose some sort of non-hashable-specific hashing function" however. For example |
Splitting |
There won't be internal-using
The two above is more work then just adding |
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)
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
(nothashable
) 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.
The text was updated successfully, but these errors were encountered: