forked from weaselab/conflict-set
Disable freelist for macos
It's faster on my mac m1 without the freelist
This commit is contained in:
@@ -694,7 +694,12 @@ constexpr int getMaxCapacity(Node *self) {
|
|||||||
self->partialKeyLen);
|
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;
|
constexpr int64_t kMaxFreeListBytes = 1 << 20;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Maintains a free list up to kMaxFreeListBytes. If the top element of the list
|
// 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
|
// 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) {
|
void release(T *p) {
|
||||||
|
assume(p->partialKeyCapacity >= 0);
|
||||||
|
assume(freeListSize >= 0);
|
||||||
if (freeListSize + sizeof(T) + p->partialKeyCapacity > kMaxFreeListBytes) {
|
if (freeListSize + sizeof(T) + p->partialKeyCapacity > kMaxFreeListBytes) {
|
||||||
removeNode(p);
|
removeNode(p);
|
||||||
return safe_free(p, sizeof(T) + p->partialKeyCapacity);
|
return safe_free(p, sizeof(T) + p->partialKeyCapacity);
|
||||||
|
|||||||
Reference in New Issue
Block a user