Speedup for guarded allocator
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 19 Aug 2013 10:51:40 +0000 (10:51 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 19 Aug 2013 10:51:40 +0000 (10:51 +0000)
commitc0f8e15295371ae69b38185d3ee5659cdd1af386
tree7a550dcc6b6e5026efc850be4a69023708379d75
parentefa836531e171028870ee50bcebc4e56a17b536b
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
12 files changed:
intern/atomic/atomic_ops.h
intern/guardedalloc/CMakeLists.txt
intern/guardedalloc/SConscript
intern/guardedalloc/intern/mallocn.c
source/blender/blenlib/BLI_threads.h
source/blender/blenlib/intern/threads.c
source/blender/makesdna/intern/CMakeLists.txt
source/blender/makesdna/intern/SConscript
source/blender/makesrna/SConscript
source/blender/makesrna/intern/CMakeLists.txt
source/blender/windowmanager/intern/wm_init_exit.c
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp