Commit ebc1155
committed
QQ: optimise memory for message references.
Currently a message references' smallest representation is an
improper list with two integer terms; the Raft index and the
message size in bytes. This has a heap overhead of 2 words +
2 words for the cons cell in the queue data structure.
This commit introduces a new more compact form that is
used if the Raft index is less than 44 bits and the
message size is less than 32KiB. In this case the
Raft index and message size is packed into a 59 bit
integer which is the largest unsigned integer that
is still an immediate term and thus has 0 heap overhead
as the integer value fits into the pointer word completely.
This reduces per message overhead to the 2 words for
the cons cell and thus halves message memory use
for a lot of scenarios.
If a message cannot be packed it will fall back
to the current list based representation.1 parent 186cd03 commit ebc1155
File tree
6 files changed
+193
-103
lines changed- deps/rabbit
- src
- test
6 files changed
+193
-103
lines changed
0 commit comments