This is an archive of the discontinued LLVM Phabricator instance.

[libc.search] [PATCH 5/6] add swisstable implementation
Needs ReviewPublic

Authored by SchrodingerZhu on Oct 21 2022, 1:32 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch adds the remaining part of the swisstable implementation.

In short, this table is an open-addressing table but it looks up multiple 2nd-level hash in a
large machine word per probe. This enables faster lookup speed, especially for those platforms with SIMD registers. This implementation
is a combined effort of abseil's version and hashbrown's version. The structure mainly follows the latter one while the recent optimization
for aarch64 from abseil is absorbed.

The swisstable header contains more features than required ones. One reason is that the table can be used for future extension. The other is that glibc and musl
also disagrees on whether the table can be resized. The swisstable is designed to provide template parameters to control whether DELETE or RESIZE are supported,
and using constexpr branches to optimize the situtations when some features are disabled.

Diff Detail