Embed root node into rtree_t.

This avoids one atomic operation per tree access.
This commit is contained in:
Jason Evans
2017-03-22 16:38:03 -07:00
parent 99d68445ef
commit ce41ab0c57
5 changed files with 86 additions and 140 deletions

View File

@@ -39,13 +39,17 @@ struct rtree_ctx_s {
#ifndef _MSC_VER
JEMALLOC_ALIGNED(CACHELINE)
#endif
rtree_ctx_cache_elm_t cache[RTREE_CTX_NCACHE];
rtree_ctx_cache_elm_t cache[RTREE_CTX_NCACHE];
};
struct rtree_s {
/* An rtree_{internal,leaf}_elm_t *. */
atomic_p_t root;
malloc_mutex_t init_lock;
malloc_mutex_t init_lock;
/* Number of elements based on rtree_levels[0].bits. */
#if RTREE_HEIGHT > 1
rtree_node_elm_t root[1U << (RTREE_NSB/RTREE_HEIGHT)];
#else
rtree_leaf_elm_t root[1U << (RTREE_NSB/RTREE_HEIGHT)];
#endif
};
#endif /* JEMALLOC_INTERNAL_RTREE_STRUCTS_H */