]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
chg: dev: Adaptive memory allocation strategy for qp-tries
authorAlessio Podda <alessio@isc.org>
Thu, 22 May 2025 22:53:48 +0000 (22:53 +0000)
committerAlessio Podda <alessio@isc.org>
Thu, 22 May 2025 22:53:48 +0000 (22:53 +0000)
qp-tries allocate their nodes (twigs) in chunks to reduce allocator
pressure and improve memory locality. The choice of chunk size presents
a tradeoff: larger chunks benefit qp-tries with many values (as seen
in large zones and resolvers) but waste memory in smaller use cases.

Previously, our fixed chunk size of 2^10 twigs meant that even an
empty qp-trie would consume 12KB of memory, while reducing this size
would negatively impact resolver performance.

This commit implements an adaptive chunking strategy that:
 - Tracks the size of the most recently allocated chunk.
 - Doubles the chunk size for each new allocation until reaching a
   predefined maximum.

This approach effectively balances memory efficiency for small tries
while maintaining the performance benefits of larger chunk sizes for
bigger data structures.

Merge branch 'alessio/qp-small-alloc' into 'main'

See merge request isc-projects/bind9!10245


Trivial merge