diff options
author | Jason Evans <jasone@canonware.com> | 2014-04-16 23:33:21 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2014-04-16 23:33:21 (GMT) |
commit | 3e3caf03af6ca579e473ace4daf25f63102aca4f (patch) | |
tree | cab29cc4b6f2506299e1aba42d23415d09e0bead /src/arena.c | |
parent | bd87b01999416ec7418ff8bdb504d9b6c009ff68 (diff) | |
parent | 021136ce4db79f50031a1fd5dd751891888fbc7b (diff) | |
download | jemalloc-3e3caf03af6ca579e473ace4daf25f63102aca4f.zip jemalloc-3e3caf03af6ca579e473ace4daf25f63102aca4f.tar.gz jemalloc-3e3caf03af6ca579e473ace4daf25f63102aca4f.tar.bz2 |
Merge pull request #73 from bmaurer/smallmalloc
Smaller malloc hot path
Diffstat (limited to 'src/arena.c')
-rw-r--r-- | src/arena.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/arena.c b/src/arena.c index 3952e70..4256344 100644 --- a/src/arena.c +++ b/src/arena.c @@ -8,6 +8,14 @@ ssize_t opt_lg_dirty_mult = LG_DIRTY_MULT_DEFAULT; arena_bin_info_t arena_bin_info[NBINS]; JEMALLOC_ALIGNED(CACHELINE) +const uint32_t small_bin2size[NBINS] = { +#define SIZE_CLASS(bin, delta, size) \ + size, + SIZE_CLASSES +#undef SIZE_CLASS +}; + +JEMALLOC_ALIGNED(CACHELINE) const uint8_t small_size2bin[] = { #define S2B_8(i) i, #define S2B_16(i) S2B_8(i) S2B_8(i) @@ -1615,7 +1623,7 @@ arena_malloc_small(arena_t *arena, size_t size, bool zero) binind = SMALL_SIZE2BIN(size); assert(binind < NBINS); bin = &arena->bins[binind]; - size = arena_bin_info[binind].reg_size; + size = small_bin2size[binind]; malloc_mutex_lock(&bin->lock); if ((run = bin->runcur) != NULL && run->nfree > 0) |