Tweak some tests to avoid the slowest path.
By caching the result of the first call to ThreadAlloc::get(), we were always hitting a code path that should be hit once per thread in normal operation.
This commit is contained in:
@@ -69,6 +69,9 @@ namespace test
|
|||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
xoroshiro::p128r64 r;
|
xoroshiro::p128r64 r;
|
||||||
|
// Force a per-thread allocator to actually exist.
|
||||||
|
void* p = ThreadAlloc::get()->alloc(16);
|
||||||
|
ThreadAlloc::get()->dealloc(p);
|
||||||
#if NDEBUG
|
#if NDEBUG
|
||||||
size_t nn = 30;
|
size_t nn = 30;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using namespace snmalloc;
|
|||||||
template<ZeroMem zero_mem>
|
template<ZeroMem zero_mem>
|
||||||
void test_alloc_dealloc(size_t count, size_t size, bool write)
|
void test_alloc_dealloc(size_t count, size_t size, bool write)
|
||||||
{
|
{
|
||||||
auto* alloc = ThreadAlloc::get();
|
auto*& alloc = ThreadAlloc::get();
|
||||||
|
|
||||||
DO_TIME(
|
DO_TIME(
|
||||||
"Count: " << std::setw(6) << count << ", Size: " << std::setw(6) << size
|
"Count: " << std::setw(6) << count << ", Size: " << std::setw(6) << size
|
||||||
|
|||||||
Reference in New Issue
Block a user