Hacker News new | past | comments | ask | show | jobs | submit login

Interesting, Abseil's btree claims to use a larger value:

... for absl::btree_set<int32_t>, nodes currently have 62 children ...

https://abseil.io/about/design/btree




From the looks of it Rust [1] uses a constant branching factor based on number of items whereas ABSEIL generally uses a target of 256 bytes [3] for branching and fits however many elements fit within that [2]. Rust’s approach seems to be more primitive as ABSEIL is optimizing for cache line usage (not sure why it’s several multiples of a cache line - maybe to help the prefetcher or to minimize cache line bouncing?)

[1] https://github.com/rust-lang/rust/blob/master/library/alloc/...

[2] https://github.com/abseil/abseil-cpp/blob/74f8c1eae915f90724...

[3] https://github.com/abseil/abseil-cpp/blob/74f8c1eae915f90724...


> not sure why it’s several multiples of a cache line - maybe to help the prefetcher or to minimize cache line bouncing?

The AMD64 cache line is only 64 bytes, that would make for very low branching factors given interior nodes need a pointer per child, plus key, plus record pointer if b-tree (as opposed to b+tree).


To be clear, I was examining only leaf nodes. I’m not sure if interior nodes use the same logic. Still, ABSEIL generally uses a larger branching factor than Rust for some undocumented reason.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: