Skip to content

Commit

Permalink
Increase Remote batch size (#158)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
mjp41 authored Mar 30, 2020
1 parent 77c4536 commit ecef894
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions src/ds/address.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

/**
Expand All @@ -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
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/mem/allocconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace snmalloc
#ifdef USE_REMOTE_BATCH
REMOTE_BATCH
#else
64
4096
#endif
;

Expand Down

0 comments on commit ecef894

Please sign in to comment.