]> git.ipfire.org Git - thirdparty/bind9.git/commit
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)
commitdc3a1bde6587ea63b72821edb93aefe93a036d1d
treef15b0224b138ef9c94b2f5922da18f7d00ce309b
parent13d0bab7c21c5028580bbdd7a32d51a3f10d8895
parentd7064c9b88555918778822881a156e6f8864ea98
chg: dev: Adaptive memory allocation strategy for qp-tries

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