[libc-commits] [libc] [libc][regex] Switch ExprPool to 32-bit ExprId and 16B Expr (PR #230687)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Tue Oct 13 13:46:05 PDT 2026
================
@@ -27,89 +30,113 @@ namespace regex {
/// This class manages the allocation and hash-consing of Expr nodes. All
/// nodes created through this pool are owned by it and will be freed when
/// the pool is destroyed. Hash-consing ensures that identical expressions
-/// are represented by the same pointer, enabling fast comparison and
+/// are represented by the same ExprId, enabling fast comparison and
/// derivative normalization.
class ExprPool {
/// Internal storage block for AST nodes.
///
- /// Blocks are allocated on demand to avoid large contiguous allocations
- /// and are linked together in a list for cleanup.
- /// TODO: Consider adopting cpp::forward_list for block management once
- /// it is available in LLVM-libc.
+ /// Blocks are allocated on demand to avoid large contiguous allocations.
struct Block {
- /// Number of Expr nodes stored in each block.
- static constexpr size_t BLOCK_SIZE = 256;
+ /// 32 nodes * 16B = 512B per block (8 cache lines).
+ static constexpr size_t BLOCK_SIZE = 32;
----------------
kaladron wrote:
Sorry, nodes per block. Fixed.
https://github.com/llvm/llvm-project/pull/230687
More information about the libc-commits
mailing list