Very nice work. I'm working on stuff... adjacent to this I guess. I've been harping on the ideas that we have to be much more willing to reach for intrinsics, be laser focused on the cache lines, treat DRAM more like an async block device, but I can't believe I haven't thought to show the impact of coherence traffic! When I get some time I might try to apply some of my tricks to bbtree. DM me. I'd love to be able to reach out when I do.
I had a feeling when I read the title and then started reading the post, "this person must be young, probably a student." I think it's ironic that they're using such unscientific terminology like "fastest" given their background https://xiangpeng.systems/. So clearly, it's in the interest of marketing. Maybe some kind of job advertising/resume thing.
I can almost guarantee that someone has built a custom btree for their specific domain which is faster than this; and that they probably have some or all of the techniques used in this library that are the main contributors to performance, as well. Prefetching is probably the main one they'll claim, and I know personally of some proprietary implementations which have it.
I would like to see some more humility, but I suppose that when you've already resigned your own potential to being below an LLM, then what's the point.
It's not possible or useful for them to grow anymore. Some new frontier model next week will outdo whatever ephemerally useful project this person writes, right? That's the logic?
Sure. I didn't mean to say that the author used CBMC, only that it's an example of model checking.
Incidentally, the docs don't seem to say what model checker was used. I don't think any of verus, shuffle, or ffs are technically model checkers (or at the very least they don't describe themselves as such)
Okay I spent an hour trying to read this AI Slop. The prefix key idea is "cool" (see: 1). Gives you sort of "best of both words" B+ tree and B tree behavior.
It only applies to `u64`, `u128`, `[u8]`, `str` (and box/vec variants) AFAIT [2]. Their own 'agentic' pre-release checklist calls this out as work that needs to be done prior to release. But then I can be wrong because as OP says
> No human can write better code than LLMs. All of the implementation is written by LLMs, and cross-checked by LLMs from different providers.
Hi author here, first of all, thank you for taking time to read the AI slop, you probably already spend more time than I do on this repo, appreciated!
The inline key: yes, it applies to all kinds of integers and strings, and it exposes InlineKey traits that allow you to implement your own inline prefix.
The checklist items: I forget to cross them and they are all implemented, although I think the checklist item has nothing to do with bbtree. but this is definitely a flaw.
We have smart batching in Dip where we deduplicate work received in what we call a "batched" request. We use BTreeMap to deduplicate work in the preprocessing "scatter" phase.
This deduplication in smart batching is the slowest phase on most bulk write workloads (200k+ inserts in a single request) and takes sometimes up to 3x the time taken for the combined fanout + db writes + db commits + gather.
The real competitors to a Btree like data structure are trie based structures, such as burst tries, (optimised) q-fast and p-fast tries, level compressed tries, bucketed tries, path compressed tries, etc
Also optimised stratified trees (van emde boas) implementations where key length permits.
Full comparison based structures are rarely necessary: ints, floats, strings, etc can be dealt with by lexicographic structures
Tries in particular work outrageously well on (unrealistic) uniform random data with log-logarithmic operation times
In my experiments, tries easily win out only when comparisons are expensive. Tries struggle against optimized btrees e.g. when you have word-sized integers as the keys.
They do win in simplicity of implementation vs performace. A bog-standard critbit tree with no tricks is almost trivial to implement. Performace wise it stays in the running against anything not heavily optimized.
This is a pretty distracting way to present good looking work, with presumably a robot friend turned loose on the presentation in a way that actively detracts from credibility.
> Xiangpeng is a real human behind bbtree, and the front line guarding the correctness of its code. All of the code is written by LLMs, but Xiangpeng steers every design decision, and is accountable for the code.
You didn't have to tell us :) Still looking forward to trying it out, especially the claims regarding memory usage, but the highly dynamic web-paper format as applied here really turns my stomach. It's good for instructional style articles, but here I found myself skipping over all the dynamic stuff just searching for signs of a human being involved (of which there is still clearly plenty, notably it has been thoroughly copyedited by a non-robot even if the structure is still somewhat robotic).
Hi author here, thank you for testing bbtree, bbtree works best if you can implement the `InlinkeKey` trait, would love to see the workloads and check if I missed anything? feel free to create an issue in the repo!
29 comments
[ 0.93 ms ] story [ 11.0 ms ] threadhttps://news.ycombinator.com/item?id=50218616
Bold claim...
This is only a statement that could be written by someone that doesn't read the code.
I can almost guarantee that someone has built a custom btree for their specific domain which is faster than this; and that they probably have some or all of the techniques used in this library that are the main contributors to performance, as well. Prefetching is probably the main one they'll claim, and I know personally of some proprietary implementations which have it.
I would like to see some more humility, but I suppose that when you've already resigned your own potential to being below an LLM, then what's the point.
It's not possible or useful for them to grow anymore. Some new frontier model next week will outdo whatever ephemerally useful project this person writes, right? That's the logic?
* https://docs.rs/sanakirja-core
* https://pijul.org/posts/2021-02-06-rethinking-sanakirja#benc...
What does model checking mean here?
[0]: https://www.cprover.org/cbmc/
Incidentally, the docs don't seem to say what model checker was used. I don't think any of verus, shuffle, or ffs are technically model checkers (or at the very least they don't describe themselves as such)
It only applies to `u64`, `u128`, `[u8]`, `str` (and box/vec variants) AFAIT [2]. Their own 'agentic' pre-release checklist calls this out as work that needs to be done prior to release. But then I can be wrong because as OP says
> No human can write better code than LLMs. All of the implementation is written by LLMs, and cross-checked by LLMs from different providers.
cites:
1. https://bbtree.xiangpeng.systems/post/#apply-to-b-trees
2. https://github.com/XiangpengHao/bbtree/blob/main/bbtree/src/...
The inline key: yes, it applies to all kinds of integers and strings, and it exposes InlineKey traits that allow you to implement your own inline prefix.
The checklist items: I forget to cross them and they are all implemented, although I think the checklist item has nothing to do with bbtree. but this is definitely a flaw.
I also appreciate your paper/work on bf-tree, I started a hobbyist filesystem based on it.
We have smart batching in Dip where we deduplicate work received in what we call a "batched" request. We use BTreeMap to deduplicate work in the preprocessing "scatter" phase.
This deduplication in smart batching is the slowest phase on most bulk write workloads (200k+ inserts in a single request) and takes sometimes up to 3x the time taken for the combined fanout + db writes + db commits + gather.
Will try out with Bbtree and see how it goes.
The quote at the top isn't related to what any of this is so it is pretty funny while being obnoxious
Also optimised stratified trees (van emde boas) implementations where key length permits.
Full comparison based structures are rarely necessary: ints, floats, strings, etc can be dealt with by lexicographic structures
Tries in particular work outrageously well on (unrealistic) uniform random data with log-logarithmic operation times
As a result, I’m skeptical of “fastest” here
B trees are great though, good work!
They do win in simplicity of implementation vs performace. A bog-standard critbit tree with no tricks is almost trivial to implement. Performace wise it stays in the running against anything not heavily optimized.
> Xiangpeng is a real human behind bbtree, and the front line guarding the correctness of its code. All of the code is written by LLMs, but Xiangpeng steers every design decision, and is accountable for the code.
You didn't have to tell us :) Still looking forward to trying it out, especially the claims regarding memory usage, but the highly dynamic web-paper format as applied here really turns my stomach. It's good for instructional style articles, but here I found myself skipping over all the dynamic stuff just searching for signs of a human being involved (of which there is still clearly plenty, notably it has been thoroughly copyedited by a non-robot even if the structure is still somewhat robotic).
I tested this on a 3D boolean mesh kernel I am working on (this is swapping out std::BTreeMap, no other code changes):
Then I thought, maybe this shines when you use big maps. I.e. more dense/complext meshes.So I used one of my test fixtures, a Nefretiti bust scan with a million vertex IDs:
I.e. a lot of the claims the post makes probably only hold under a specific and possibly narrow set of use cases the author tested agains.std::BTreeMap must hold ideally hold up well under any use case for such a map. That always means compromises must be made.