diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 14:51:40 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-19 14:51:40 +0400 |
commit | c0f8e15295371ae69b38185d3ee5659cdd1af386 (patch) | |
tree | 7a550dcc6b6e5026efc850be4a69023708379d75 /intern/atomic/atomic_ops.h | |
parent | efa836531e171028870ee50bcebc4e56a17b536b (diff) |
Speedup for guarded allocator
- Re-arrange locks, so no actual memory allocation
(which is relatively slow) happens from inside
the lock. operation system will take care of locks
which might be needed there on it's own.
- Use spin lock instead of mutex, since it's just
list operations happens from inside lock, no need
in mutex here.
- Use atomic operations for memory in use and total
used blocks counters.
This makes guarded allocator almost the same speed
as non-guarded one in files from Tube project.
There're still MemHead/MemTail overhead which might
be bad for CPU cache utilization
Diffstat (limited to 'intern/atomic/atomic_ops.h')
-rw-r--r-- | intern/atomic/atomic_ops.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/intern/atomic/atomic_ops.h b/intern/atomic/atomic_ops.h index 845e517a42f..7baa5f6ecac 100644 --- a/intern/atomic/atomic_ops.h +++ b/intern/atomic/atomic_ops.h @@ -44,7 +44,8 @@ # endif #endif -#if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__) +/* TODO(sergey): check on other 64bit platforms. */ +#if defined(_M_X64) || defined(_M_AMD64) || defined(__amd64__) || defined(__x86_64__) # define LG_SIZEOF_PTR 3 # define LG_SIZEOF_INT 3 #else |