mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-02 02:04:20 +03:00
Redesign the cache bin metadata for fast path.
Implement the pointer-based metadata for tcache bins -- - 3 pointers are maintained to represent each bin; - 2 of the pointers are compressed on 64-bit; - is_full / is_empty done through pointer comparison; Comparing to the previous counter based design -- - fast-path speed up ~15% in benchmarks - direct pointer comparison and de-reference - no need to access tcache_bin_info in common case
This commit is contained in:
parent
d2dddfb82a
commit
7599c82d48
9 changed files with 340 additions and 122 deletions
|
|
@ -2368,7 +2368,7 @@ je_malloc(size_t size) {
|
|||
|
||||
cache_bin_t *bin = tcache_small_bin_get(tcache, ind);
|
||||
bool tcache_success;
|
||||
void* ret = cache_bin_alloc_easy(bin, &tcache_success);
|
||||
void *ret = cache_bin_alloc_easy(bin, &tcache_success, ind);
|
||||
|
||||
if (tcache_success) {
|
||||
if (config_stats) {
|
||||
|
|
@ -2846,8 +2846,7 @@ bool free_fastpath(void *ptr, size_t size, bool size_hint) {
|
|||
}
|
||||
|
||||
cache_bin_t *bin = tcache_small_bin_get(tcache, alloc_ctx.szind);
|
||||
cache_bin_info_t *bin_info = &tcache_bin_info[alloc_ctx.szind];
|
||||
if (!cache_bin_dalloc_easy(bin, bin_info, ptr)) {
|
||||
if (!cache_bin_dalloc_easy(bin, ptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue