Messages in this thread | | | Date | Sat, 10 Jan 2009 21:23:16 +0100 | From | Jörn Engel <> | Subject | Re: [PATCH] add b+tree library |
| |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |