208 points · by reconditerose · 2w ago · 76 comments
P.S. I tried several variants with different representations, so this specific implementation is the Pareto frontier in speed/size of many, many attempts.
today no longer a problem
To be sure, you think these problems are tackleable now due to AI (my impression of your comment)? Or to advances in {yourself}/{else} in the ecosystem? How do you deal with managing the complexity now? Is it 'easier' because we as humans no longer need to do the decently complex step of writing most of it? Or iterations/... enabled by AI are able to reduce the long tails around experimenting/benchmarking with these kinds of complex structures?Some of his concurrency ideas were pretty good but Skip Lists were about the same time I was realizing that theoretical and practical design for performance had diverged and skip lists were a huge cache miss liability.
It didn't hurt that a few people I was aware had tried them had gone back to something else due to live performance analysis being negative or inconclusive (If you can't prove one thing is better than the other, you use the simpler one, and skiplists are not simple)
That cost varies from chip generation to generation, but it does seem to be the case that b trees win in more generations than they lose.
We don't like the O(n) worst case, but we really like that magical amortization property. There are some simple ways to avoid getting into a linear hot path.
One of the last large dev blog entries for V8 was about how they got pointer compression to be performance neutral and that’s down to getting the translation down below the amortized cache hit penalty for 64 bit pointers. IIRC the JVM gets close to that as well.
Can you please clarify: Simpler in operation or simple in implementation? Or neither/both?
Curious. Skiplists don't need back pointers. You can traverse a skiplist backward almost as fast as forward if you keep the "finger" around. The finger is the set of nodes from level-n down to level-0 that point as close to the goal node as possible without going beyond it. The ideal place to keep these nodes is on the stack. To traverse backwards, you do a conventional search for the starting node but every time you go down a pointer level, you push the last pointer on the stack first. Then back traversal becomes stack pops together with appropriate forward recursive calls when you pop back to a pointer that was too far to the left.
It's easier to convey the idea with code than english but I'm not typing the algorithm with my thumbs into my phone.
There is a reviewing guide with suggested reading order, clear design decisions, and scope boundaries for what is intentionally not included.
This is the type of thing LLMs are very good at and high ROI for human reviewers.
Not sure about the name reviewing guide, but I do like the contents. Then again I know nothing about code base.
Nice!
At some point I'd love to see a "shoot-out" benchmark between different B+ Tree based database back-end engines, in terms of Insert, Update, Delete, (and simultaneous occurrences of all of the above) etc., but not just for a single thread -- across multiple threads, CPU's/GPU's, different cache hierarchies, etc., and for absolutely gargantuan amounts of data...
Which data structure and associated algorithms truly perform the best against a variety of truly heterogeneous (in this day and age, with all kinds of asymmetric hardware to choose from!) back-ends?
Anyway, we welcome Valkey to the list of contenders!
And a moderate LLM subscription can readily generate a useful portion of this project overnight, which makes me concerned about their profitability in the long run.
> if you modify an AGPL-licensed program and offer it as a service over a network, you are obligated to provide the source code of that modified program to anyone who interacts with it over the network
AGPL is in general banned in my company anywhere close to the developers. Too much risk we'd have to provide our trade secrets for everyone.
(Disclosure, worked for them 3 years ago for a few months)
At this point have we optimized hardware to assume B trees in a sort of self-fulfilling prophesy?
On a cold cache, you pay for each level of indirection, so you want to increase fan-out as much as possible. B-trees do that intrinsically.
I’m not convinced that dedicating 4GB to each processor isn’t the better solution. But it’s a chicken and egg because who would code to it? I think Rust could manage it via the borrow checker, but everyone else would be toast.
The PR for the article. I'm not convinced it's AI, but I didn't do a deep dive on the commit tree just poked around a bit.