hashbrown
hashbrown copied to clipboard
Properly document algorithm
Note: this also applies to the libstd documentation, since it just reuses the same documentation exported in this crate.
Right now, the only documentation available for the hashbrown implementation, excluding the code itself (which is not documentation), is these this:
The hash table implementation is a Rust port of Google’s SwissTable. The original C++ version of SwissTable can be found here, and this CppCon talk gives an overview of how the algorithm works.
As far as I'm aware, the algorithm is not a clear-cut port of the C++ version, and there are definitely changes to how the internals work. Additionally, I don't consider the talk documentation, since while it may be an excellent introduction and provides motivation to the concept, it is in no way documenting how the table actually works.
While I understand that the purpose of a general hash map is to avoid concerning users with the details, I think that documenting how exactly this implementation works is useful to both those trying to implement their own variations, or those who wish to work with the source code and modify it in some way.