Increase Remote batch size (#158)

* Increase Remote batch size

The remote batch size has not changed since the fast path optimisations.
The optimisations mean we are checking the queue considerably less
often, so the batch should be larger.  This has a dramatic improvement
on performance on a few of the mimalloc microbenchmarks.

It is set to 4096 as this should cover the worse case scenario of only
remote deallocation at 16 bytes for the 2^16 slab size.

* Fixes for Clang-10

Clang-10 outputs a warning for calling alignment intrinsic with an
alignment of 1. At add constexpr to handle this case.
This commit is contained in:
Matthew Parkinson
2020-03-30 13:40:09 +01:00
committed by GitHub
parent 77c453600b
commit ecef894525
2 changed files with 15 additions and 5 deletions

View File

@@ -65,11 +65,16 @@ namespace snmalloc
{
static_assert(alignment > 0);
static_assert(bits::next_pow2_const(alignment) == alignment);
if constexpr (alignment == 1)
return static_cast<T*>(p);
else
{
#if __has_builtin(__builtin_align_down)
return static_cast<T*>(__builtin_align_down(p, alignment));
return static_cast<T*>(__builtin_align_down(p, alignment));
#else
return pointer_cast<T>(bits::align_down(address_cast(p), alignment));
return pointer_cast<T>(bits::align_down(address_cast(p), alignment));
#endif
}
}
/**
@@ -81,11 +86,16 @@ namespace snmalloc
{
static_assert(alignment > 0);
static_assert(bits::next_pow2_const(alignment) == alignment);
if constexpr (alignment == 1)
return static_cast<T*>(p);
else
{
#if __has_builtin(__builtin_align_up)
return static_cast<T*>(__builtin_align_up(p, alignment));
return static_cast<T*>(__builtin_align_up(p, alignment));
#else
return pointer_cast<T>(bits::align_up(address_cast(p), alignment));
return pointer_cast<T>(bits::align_up(address_cast(p), alignment));
#endif
}
}
/**

View File

@@ -35,7 +35,7 @@ namespace snmalloc
#ifdef USE_REMOTE_BATCH
REMOTE_BATCH
#else
64
4096
#endif
;