]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Rework] Convert heap to fully intrusive kvec-based implementation
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 21 Oct 2025 09:37:28 +0000 (10:37 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 21 Oct 2025 09:37:28 +0000 (10:37 +0100)
commit0cd32b4d45a7bd8a95472f229dc553516c18af56
tree6760a1b71d1c5741f7484cedd9c9e7e19404695f
parenta6b086302cc36adb33eb74c3d9bc7116695dc55a
[Rework] Convert heap to fully intrusive kvec-based implementation

Convert the heap implementation from pointer-based to fully intrusive
design where elements are stored directly in the kvec array.

Key changes:
- Remove heap.c, convert to macro-only header implementation
- Store elements by value in kvec_t(elt_type) instead of kvec_t(elt_type *)
- Improve cache locality by eliminating pointer indirection
- Fix swim/sink operations to properly track elements during swaps
- Update rspamd_heap_pop to return pointer to popped element
- Update memory pool destructor heap to use new intrusive API
- Update heap tests for value-based element storage

Performance benefits:
- Better cache locality (elements stored contiguously)
- No per-element allocation overhead
- Reduced memory usage (no pointer array)
src/libutil/CMakeLists.txt
src/libutil/heap.c [deleted file]
src/libutil/heap.h
src/libutil/mem_pool.c
src/libutil/mem_pool_internal.h
test/rspamd_heap_test.c