[libc-commits] [libc] [libc][tsearch] add weak AVL tree for tsearch implementation (PR #172411)

Schrodinger ZHU Yifan via libc-commits libc-commits at lists.llvm.org
Wed Jan 14 10:13:48 PST 2026


SchrodingerZhu wrote:

> This is just an additional reference, but we've been using WAVL trees in Fuchsia since 2016: https://cs.opensource.google/fuchsia/fuchsia/+/1ac34de6347721e131c30d128d6c45b4099d778f

If I did not remember it wrongly, the Fuchsia version is using the rank parity variant, where the tag can be encoded in 1 bit but requires checking the parity difference to check the rank difference between children. @MaskRay mentioned that, 1-bit variant and this 2-bit version sometimes have subtle performance difference.

As we are not encoding tag in pointer to save memory, I think 2-bit version is bit more clear to understand.

https://github.com/llvm/llvm-project/pull/172411


More information about the libc-commits mailing list