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:
David Chisnall
2019-07-04 15:06:51 +01:00
parent b8a5d7fca9
commit 829d8e856b
2 changed files with 4 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ using namespace snmalloc;
template<ZeroMem zero_mem>
void test_alloc_dealloc(size_t count, size_t size, bool write)
{
auto* alloc = ThreadAlloc::get();
auto*& alloc = ThreadAlloc::get();
DO_TIME(
"Count: " << std::setw(6) << count << ", Size: " << std::setw(6) << size