[libc-commits] [PATCH] D136491: [libc.search] [PATCH 5/6] add swisstable implementation

Schrodinger ZHU Yifan via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Oct 21 13:32:15 PDT 2022


SchrodingerZhu created this revision.
Herald added subscribers: libc-commits, kristof.beyls.
Herald added projects: libc-project, All.
SchrodingerZhu requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136491

Files:
  libc/src/__support/CMakeLists.txt
  libc/src/__support/swisstable.h
  libc/test/src/__support/CMakeLists.txt
  libc/test/src/__support/swisstable/CMakeLists.txt
  libc/test/src/__support/swisstable/bitmask_test.cpp
  libc/test/src/__support/swisstable/group_test.cpp
  libc/test/src/__support/swisstable/hashtable_test.cpp
  libc/test/src/__support/swisstable/safe_mem_size_test.cpp
  libc/test/src/__support/swisstable/test_utils.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136491.469751.patch
Type: text/x-patch
Size: 43763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221021/3e0c63d1/attachment-0001.bin>


More information about the libc-commits mailing list