3 ms·
You're implementing a Slab allocator. That's exactly what any Slab allocator does, including gmalloc, tcmalloc, jemalloc and SLUB (Linux kernel). But, there is
by afr0ck 3y ago
You're implementing a Slab allocator. That's exactly what any Slab allocator does, including gmalloc, tcmalloc, jemalloc and SLUB (Linux kernel). But, there is probably much much more you can do on a modern machine to squeeze even more performance. Some of the things that comes into my mind are: reducing tlb stalls with hugepage awareness[1], and reducing false cache sharing on SMPs [2].
For the compression part, have you thought about OS-managed memory compression [3][4]?
[1] https://google.github.io/tcmalloc/temeraire.html https://google.github.io/tcmalloc/temeraire.html
[2] https://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf https://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemal...
[3] https://dl.acm.org/doi/pdf/10.1145/3297858.3304053 https://dl.acm.org/doi/pdf/10.1145/3297858.3304053
[4] https://www.kernel.org/doc/Documentation/vm/zswap.txt https://www.kernel.org/doc/Documentation/vm/zswap.txt