Cache an arena's index in the arena.
This saves us a pointer hop down some perf-sensitive paths.
This commit is contained in:
parent
229994a204
commit
4c46e11365
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
static inline unsigned
|
static inline unsigned
|
||||||
arena_ind_get(const arena_t *arena) {
|
arena_ind_get(const arena_t *arena) {
|
||||||
return base_ind_get(arena->base);
|
return arena->ind;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -83,6 +83,12 @@ struct arena_s {
|
|||||||
*/
|
*/
|
||||||
bins_t bins[SC_NBINS];
|
bins_t bins[SC_NBINS];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A cached copy of base->ind. This can get accessed on hot paths;
|
||||||
|
* looking it up in base requires an extra pointer hop / cache miss.
|
||||||
|
*/
|
||||||
|
unsigned ind;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base allocator, from which arena metadata are allocated.
|
* Base allocator, from which arena metadata are allocated.
|
||||||
*
|
*
|
||||||
|
@ -1475,6 +1475,7 @@ arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) {
|
|||||||
arena->base = base;
|
arena->base = base;
|
||||||
/* Set arena before creating background threads. */
|
/* Set arena before creating background threads. */
|
||||||
arena_set(ind, arena);
|
arena_set(ind, arena);
|
||||||
|
arena->ind = ind;
|
||||||
|
|
||||||
nstime_init_update(&arena->create_time);
|
nstime_init_update(&arena->create_time);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user