Fix long spinning in rtree_node_init

rtree_node_init spinlocks the node, allocates, and then sets the node.
This is under heavy contention at the top of the tree if many threads
start to allocate at the same time.

Instead, take a per-rtree sleeping mutex to reduce spinning.  Tested
both pthreads and osx OSSpinLock, and both reduce spinning adequately

Previous benchmark time:
./ttest1 500 100
~15s

New benchmark time:
./ttest1 500 100
.57s
This commit is contained in:
Dave Watson
2016-10-31 16:23:33 -07:00
committed by Jason Evans
parent 712fde79fd
commit 25f7bbcf28
4 changed files with 15 additions and 19 deletions

View File

@@ -28,7 +28,8 @@ typedef int witness_comp_t (const witness_t *, void *, const witness_t *,
#define WITNESS_RANK_ARENA_EXTENT_CACHE 10
#define WITNESS_RANK_RTREE_ELM 11U
#define WITNESS_RANK_BASE 12U
#define WITNESS_RANK_RTREE 12U
#define WITNESS_RANK_BASE 13U
#define WITNESS_RANK_LEAF 0xffffffffU
#define WITNESS_RANK_ARENA_BIN WITNESS_RANK_LEAF