-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add support for checking the size of the table #10
Comments
This ticket's description is... lacking. I assume it means the following problem: If you call |
@nominolo I think the underlying vector code should be responsible for throwing an exception or otherwise indicating OOM in this case. |
@nominolo I meant counting the amount of elements in table. |
In general the reason there's no size function for the typeclass is that it's O(n) for all but one of them. That said, I should probably add a size function to BasicHashTable, since O(1) size is possible there. |
What about adding an extra |
Because hashtables are about speed, and if you don't need to do this bookkeeping (and clearly it's not necessary at least in the case of cuckoo hash), the program can go faster. As you've noted, the wrapper API is trivial. One thing we could do is include the wrapper into the package -- but doing it right is a matter of design. We do have this information for the "basic" (linear probing) table, just not for the others -- so we wouldn't want to do extra work there. Associated type synonyms might work there. |
I've implemented a dome library over "hashtables", which approaches this issue amongst others. In the coming days I'll be test-driving it in another project. If no major issues arise, I'll release it right after. I'll post back here with updates. |
I've just released the library I was talking about: http://hackage.haskell.org/package/hashtables-plus |
Actually nvmd, it seems the existing |
I second this. It will be useful to have |
No description provided.
The text was updated successfully, but these errors were encountered: