Как стать автором
Обновить

Комментарии 2

Как обычно, обо всех неточностях, ошибках и просто казусах перевода прошу сообщать в ЛС. Спасибо.
Тогда уж и коммент из источника возьмем
It seems you're using first-come-first-serve linear probing. Why not robinhood (with backshifting)? As far as I know, this significantly improves average search times, even when increasing the load factor. This is the current strategy that Rust's HashMap takes (load factor 0.91).

Instead of a bitset, we also store the hashes themselves to facilitate the robinhood checking (we set the most-significant bit of hashes so 0 doesn't occur naturally). This also provides a fastpath for equality checking. Even under a collision, the full (63-bit) hash is unlikely to be equal, so you only only ever incur the cost of looking at the keys when you hit an exact hash-match, which is almost guaranteed to be an exact key match. You don't expect to ever look at the keys if the key isn't present.
Зарегистрируйтесь на Хабре, чтобы оставить комментарий

Публикации

Истории