Re: [PATCH] add b+tree library

From: Johannes Berg
Date: Wed Feb 04 2009 - 19:19:39 EST


Let me get back to this...

> > The IDR code there wasn't very well designed and still has holes. The
> > radix-tree code afaik is solid, but look at all the stuff it does!
>
> Yeah, its a bit of a mess, but solvable, as radix trees show.

To be fair, it hasn't been attempted yet though.

> B-tree's however have one thing over RB-trees, B-trees can be made
> RCU-safe whereas RB-trees cannot be -- the only problem is that Joern's
> doesn't do that.
>
> I've been poking at my B-tree implementation but got distracted by the
> mutex spin stuff, its still buggy (still the insert sibling overflow --
> the rest should be ok-ish, although I need a hard look at the memory
> barriers).

Joern may need arbitrary key lengths, don't. But I've just looked around
a little:

* radix trees are completely unsuitable for use as a sort of hash table
because of their behaviour when keys are not at last mostly
contiguous
* rbtrees require lots of boilerplate code, and have much worse cache
behaviour

In my use case, tracking the wifi APs around you, you have to scale from
a single one to >1k (yes, it's happening!), and lookups better be fast
because you might be doing them a lot (dozens of times per second).

johannes

Attachment: signature.asc
Description: This is a digitally signed message part