Repository navigation
perf: 64 位位图加速槽位查找与容量更新 - #10
Merged
Merged
Conversation
This was referenced Oct 7, 2026
carsontung666
force-pushed
the
feat/bitmap-allocation
branch
from
October 17, 2026 20:11
759b3c2 to
eca2ff3
Compare
carsontung666
force-pushed
the
feat/bitmap-allocation
branch
from
October 17, 2026 20:43
eca2ff3 to
77b83d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
将
free_bitmap[8]的逐位循环操作统一替换为 64 位位图运算,在不改变sbo_box_t内存布局、共享内存兼容性与最右适配(rightmost fit)策略的前提下,将单线程分配/释放吞吐提升 3.1x–3.6x。主要改动
sbo_alloc_obj_slots改用 64 位倍增移位与clzll定位最右连续空闲段,单次掩码写回;sbo_alloc_box_slot改用ctzll定位最左空闲槽;sbo_free_obj_slots及位图区间操作统一改为 64 位掩码批量更新。sbo_bm_continuous_max对单段空闲走clzll + ctzllsbo_find_alloc遍历子 box 前先校验child_max_cap,并将sbo_find_alloc/sbo_update_parent的子槽扫描上限收敛至box_boundary。tutorial/19_bitmap_oracle.c(1,251,900 组位图分配/释放与多层容量传播校验)并接入 CTest。性能对比(对比
main6e82bcc,GCC 13.2-O3,5 次中位数)main02_bench(耗时)08_bench_pure(1T)14_bench_alloc_only(alloc-only1T)14_bench_alloc_only(alloc+free1T)16_bench_malloc(slotsboxmalloc1T)验证
tutorial/test.py:18/18 通过