Disable freelist for macos

It's faster on my mac m1 without the freelist
This commit is contained in:
2024-11-19 14:28:15 -08:00
parent 80f0697e79
commit ceecc62a63
+7
View File
@@ -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 <class T> 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);