Changes the representation in Metaslab Used

Used is now set to 1, when the slab is full.  This means that the test
for
 used - 1 == 0
can be used to detect leaving full, and entering empty, reducing fast
path deallocation branchs by 1.
This commit is contained in:
Matthew Parkinson
2019-11-19 16:25:27 +00:00
parent b889f11d04
commit cb4b8fa545
3 changed files with 33 additions and 40 deletions

View File

@@ -8,6 +8,7 @@ namespace snmalloc
// We use size_t as it generates better code.
using sizeclass_t = size_t;
// using sizeclass_t = uint8_t;
using sizeclass_compress_t = uint8_t;
constexpr static uint16_t get_initial_offset(sizeclass_t sc, bool is_short);
constexpr static size_t sizeclass_to_size(sizeclass_t sizeclass);