From ceecc62a63dd7203efa542e1c6990d27d3f77fbe Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 19 Nov 2024 14:28:15 -0800 Subject: [PATCH] Disable freelist for macos It's faster on my mac m1 without the freelist --- ConflictSet.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index f76f21e..25891a4 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -694,7 +694,12 @@ constexpr int getMaxCapacity(Node *self) { self->partialKeyLen); } +#ifdef __APPLE__ +// Disabling the free list altogether is faster on my mac m1 +constexpr int64_t kMaxFreeListBytes = 0; +#else constexpr int64_t kMaxFreeListBytes = 1 << 20; +#endif // Maintains a free list up to kMaxFreeListBytes. If the top element of the list // doesn't meet the capacity constraints, it's freed and a new node is allocated @@ -729,6 +734,8 @@ template struct NodeAllocator { } void release(T *p) { + assume(p->partialKeyCapacity >= 0); + assume(freeListSize >= 0); if (freeListSize + sizeof(T) + p->partialKeyCapacity > kMaxFreeListBytes) { removeNode(p); return safe_free(p, sizeof(T) + p->partialKeyCapacity);