News for hackers. Stuff that matters.
Re:My LSM tree was slower than a B-tree. Then I profiled it by Retr0id on Thursday June 18, 2026 @03:49PM (#48590599)
> A 100-bit bloom filter holding 100,000 keys is saturated instantly

> This is the kind of bug you only find by building the thing and measuring it.

No? I mean, maybe if you're vibecoding it's the only way, but in the prehistoric days you could reason about what code would do before you ran it.

Re:My LSM tree was slower than a B-tree. Then I profiled it by bawolff on Thursday June 18, 2026 @03:59PM (#48590699)
Mistakes are always easy to recognize in retrospect, so hopefully this comment isnt too unfair, but one thing that caught me about this, is that logically it makes no sense. You would never use a bloom filter for just 10 entries. If you have only 10 entries it is almost certainly faster to skip the bloom filter. So i feel like that is the part that should have instantly stood out.

[Obviously, i've made my own silly mistakes over the years, many much sillier than this, its just weird to describe this one as only detectable by profiling]

Re:My LSM tree was slower than a B-tree. Then I profiled it by FarmerPotato on Thursday June 18, 2026 @04:07PM (#48590816)
Sure, it logically makes no sense. But while learning a new subject, have you never made a silly mistake like:

bool getSchemaSizes(size_t * expectedBatchSize, size_t * expectedEntriesPerBlock) { ... }

size_t expectedEntriesPerBlock, expectedBatchSize;

getSchemaSizes(&expectedEntriesPerBlock, &expectedBatchSize)

initBloomFilter(expectedEntriesPerBlock)

Re:My LSM tree was slower than a B-tree. Then I profiled it by bawolff on Thursday June 18, 2026 @04:10PM (#48590847)
I said as much in my comment.
Re:My LSM tree was slower than a B-tree. Then I profiled it by HelloNurse on Friday June 19, 2026 @11:34AM (#48599782)
The quoted code suggests that the wrong sizes aren't evident constants in code (there is a function to compute/retrieve them) and extra inspection during debugging is the most plausible way to detect them.

Hopefully this kind of bug is enough to teach the important of measuring, logging and testing to a naive optimist.

Re:My LSM tree was slower than a B-tree. Then I profiled it by ignoreusernames on Thursday June 18, 2026 @04:04PM (#48590769)
Yeah, especially a bloomfilter which has a pretty easy formula for its false positive rate.
Re:My LSM tree was slower than a B-tree. Then I profiled it by jasonwatkinspdx on Thursday June 18, 2026 @04:11PM (#48590857)
A lot of people know the basic rule of thumb that a byte per element gives you a bit more than a 1% false positive rate.

But even just thinking about it for half a second from a balls and bins perspective, 100k items into 100 binary bins is obviously gonna saturate.

Re:My LSM tree was slower than a B-tree. Then I profiled it by FarmerPotato on Thursday June 18, 2026 @04:01PM (#48590730)
Do you think the author is somehow capable of writing the entire codebase, but not able to reason about code???

I'm sure you've never made a silly mistake where you passed the wrong integer parameter to a function, stared at your screen, and failed to notice it. Or, forgot the order of arguments to calloc().

If you're saying that profiling is for those too lazy to reason about their code, you're distorting the whole lesson: profiling is more powerful than guessing.

Re:My LSM tree was slower than a B-tree. Then I profiled it by Retr0id on Thursday June 18, 2026 @04:10PM (#48590855)
I make all sorts of silly mistakes, but I'd rarely say that running the code is the only way to detect issues.

I also don't think the author wrote much of their codebase, or much of their blog post, but that's the brave new world we're living in.

Re:My LSM tree was slower than a B-tree. Then I profiled it by shermantanktop on Thursday June 18, 2026 @04:06PM (#48590802)
I'm called in to consult on a performance problem on a scaled service. Team was load testing their code and seeing low throughput:

Me: so you have an in-memory cache, right?

Them: yes!

Me: what is the TTL?

Them: Oh, it's not set, oops. Here, let's set it to 1 minute. Hey look, the performance went way up!

Me: okay, great. When you say 1 minute, do you mean 60 seconds?

Them: uh...wait...uh....oh, the unit is seconds. Wait, why is the performance so good with a 1 second TTL?

Me: What's your load test?

Them: We crank 1M TPS fetching the same 30 items over and over.

Me: ....

I totally agree about the power of profiling but profiling without understanding would not have helped this team.

Re:My LSM tree was slower than a B-tree. Then I profiled it by FarmerPotato on Thursday June 18, 2026 @04:12PM (#48590872)
So the author is doing a self-learning exercise about profiling pre-production code, and you're disagreeing with them by comparing it to a commercial contract. I'm sure you've never, ever made a dumb mistake while getting paid.
Re:My LSM tree was slower than a B-tree. Then I profiled it by shermantanktop on Thursday June 18, 2026 @05:17PM (#48591746)
I've even made dumb mistakes while NOT getting paid. But even so, I have no idea what you're talking about.
Re:My LSM tree was slower than a B-tree. Then I profiled it by achierius on Thursday June 18, 2026 @04:03PM (#48590760)
No, that's not the point. This isn't a situation where you need to "guess"; bloom filters should be sized according to their capacity. This is akin to having a fixed 10-arg buffer for your program, getting a crash when someone passes 11, and saying "this is the kind of bug you only find by building the thing and measuring it". Yeah it happens and we all make silly mistakes, but it's just not true that this couldn't have been foreseen.
Re:My LSM tree was slower than a B-tree. Then I profiled it by FarmerPotato on Thursday June 18, 2026 @04:10PM (#48590850)
Cool! My first downvote!
Re:My LSM tree was slower than a B-tree. Then I profiled it by plorkyeran on Thursday June 18, 2026 @04:58PM (#48591478)
The author didn't write the blog post so my default assumption is they didn't write the code either.
Re:My LSM tree was slower than a B-tree. Then I profiled it by tensegrist on Thursday June 18, 2026 @04:22PM (#48590999)
i don't know why you're trying to analyze the meaningfulness of sentences that are not the results of a human thought process but are clearly rhetorical flourishes from an llm that "feels" compelled to fill its prose with them
Re:My LSM tree was slower than a B-tree. Then I profiled it by Retr0id on Thursday June 18, 2026 @04:25PM (#48591047)
Comments that explicitly call out an article as slop tend to get downvoted (or disagreed with), it's best to guide the reader towards their own conclusions.
Re:My LSM tree was slower than a B-tree. Then I profiled it by paulb73 on Thursday June 18, 2026 @04:29PM (#48591103)
Isn't this what units tests are for?