Re: [PATCH] add b+tree library

Jörn Engel
2009-01-10T20:23:40Z

On Sat, 10 January 2009 20:41:03 +0100, Andi Kleen wrote:
> Johannes Berg <johannes@sipsolutions.net> writes:
>
> > Also, to elaborate on that answer, I'm going to use this as a sort of
> > hash table for wireless, where it ensures better scalability than a pure
> > hashtable from quiet environments (say wireless off on an airplane) to
> > your wireless test lab (100+ access points)
>
> Is there any particular reason you can't use the standard rbtrees
> for that?

Can't think of any. You can use linked lists as well. Whether you want
to is a different matter.

Key difference is the number of cachelines you need to find a particular
entry. rbtrees have a fanout of sqrt(3), so for a million elements (to
pick a random example) you need about 25 cachelines with rbtrees and
about 5-16 with btrees. Closer to 5 if keys and pointers are small and
cachelines are large, closer to 16 if keys and pointers are large and
cachelines are small.

Jörn

--
The key to performance is elegance, not battalions of special cases.
-- Jon Bentley and Doug McIlroy