diff options
author | Josh Blum | 2013-02-15 01:08:22 -0600 |
---|---|---|
committer | Josh Blum | 2013-02-15 01:08:22 -0600 |
commit | 08e3ae0453c0a06a14b2bf0eedd4f843867982a0 (patch) | |
tree | faa86bf60ec7ecdb4a57d965e78d0df0f6e3f699 | |
parent | ea69a25436ce2a91940b93fab5a604a25a52049c (diff) | |
download | sandhi-08e3ae0453c0a06a14b2bf0eedd4f843867982a0.tar.gz sandhi-08e3ae0453c0a06a14b2bf0eedd4f843867982a0.tar.bz2 sandhi-08e3ae0453c0a06a14b2bf0eedd4f843867982a0.zip |
gras: more fun with branch hints in allocator
-rw-r--r-- | lib/theron_allocator.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/theron_allocator.cpp b/lib/theron_allocator.cpp index 8a654f3..9db9367 100644 --- a/lib/theron_allocator.cpp +++ b/lib/theron_allocator.cpp @@ -54,10 +54,10 @@ static struct WorkerAllocator : Theron::IAllocator void *Allocate(const SizeType size) { - if (size <= MY_ALLOCATOR_CHUNK_SIZE) + if GRAS_LIKELY(size <= MY_ALLOCATOR_CHUNK_SIZE) { mSpinLock.Lock(); - if (queue.empty()) + if GRAS_UNLIKELY(queue.empty()) { unwanted_malloc_count++; mSpinLock.Unlock(); @@ -78,7 +78,7 @@ static struct WorkerAllocator : Theron::IAllocator void Free(void *const memory) { const bool in_pool = ptrdiff_t(memory) >= ptrdiff_t(pool) and ptrdiff_t(memory) < pool_end; - if (in_pool) + if GRAS_LIKELY(in_pool) { mSpinLock.Lock(); queue.push_front(memory); |