public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@logfs.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Theodore Tso <tytso@mit.edu>,
	Johannes Berg <johannes@sipsolutions.net>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] add b+tree library
Date: Sun, 11 Jan 2009 09:20:11 +0100	[thread overview]
Message-ID: <20090111082010.GA30090@logfs.org> (raw)
In-Reply-To: <20090110222656.GJ26290@one.firstfloor.org>

On Sat, 10 January 2009 23:26:56 +0100, Andi Kleen wrote:
> 
> > Finally, are b+tree so much better than rbtrees that it would be
> > worthwhile to just *replace* rbtrees with b+trees?  Or is the problem
> 
> There've been a couple of proposals like this over the years, also
> with other data structures like judy trees (which seem to bring
> the cache line optimization Joern talks about to even more extreme).
> splay trees seem to be also a popular suggestion, although they've
> considered dubious by other people (including me). Another
> alternative would be skip lists. 

The number of people that truly understand what Judy trees do may be
single-digit.  Main disadvantage I see is that Judy trees heavily rely
on repacking nodes over and over.  Part of Judy is a memory manager with
essentially slab caches for nodes with 2, 4, 6, 8, 12, 16, 24, 32, 48,
64, 96, 128, 192, 256, 384 and 512 words.

Splay trees are still binary trees, so the fan-out argument is identical
to that against rbtrees.  If we have to pull in a cacheline, we might as
well use all of it.

Skip lists are just a Bad Idea(tm).  In O(x) notation they behave like
binary trees, waste cachelines left and right, use more memory, depend
on a sufficiently good random() function,...  I guess you never closely
looked at them, because anyone who does tries to forget them as fast as
possible.

> Also I don't remember there was ever a big discussion about
> rbtrees vs other trees -- it was just that Andrea liked
> them and added a convenient library and some point and other
> people found it convenient too and started using it.
> 
> But it's unclear how much all that would really help.
> 
> I always thought it might be advanteous to look at a little
> more abstract interface for the existing rbtree users (shouldn't
> be that hard, the interface is already not too bad) and then just 
> let some students implement a couple of backend data structures
> for that interface and then run some benchmarks.
> 
> I don't think it's a good idea to add a b*tree library
> and use it only from a few users though. After all it's
> a lot of code and that should have a clear benefit.

Quoting Dave Chinner:
| I think a btree library would be useful - there are places where
| people are using rb-trees instead of btree simply because it's
| easier to use the rbtree than it is to implement a btree library.
| I can think of several places I could use such a library for
| in-memory extent representation....

Jörn

-- 
Joern's library part 15:
http://www.knosof.co.uk/cbook/accu06a.pdf

  reply	other threads:[~2009-01-11  8:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-10 10:47 [PATCH] add b+tree library Johannes Berg
2009-01-10 11:02 ` KOSAKI Motohiro
2009-01-10 11:37   ` Johannes Berg
2009-01-10 11:56     ` Jörn Engel
2009-01-10 12:29     ` KOSAKI Motohiro
2009-01-10 18:39       ` Jörn Engel
2009-01-10 18:44         ` Johannes Berg
2009-01-10 19:41           ` Andi Kleen
2009-01-10 20:22             ` Johannes Berg
2009-01-10 20:23             ` Jörn Engel
2009-01-10 21:27               ` Theodore Tso
2009-01-10 22:01                 ` Jörn Engel
2009-01-10 22:23                   ` Andrew Morton
2009-01-10 23:57                     ` Peter Zijlstra
2009-01-11  8:30                       ` Jörn Engel
2009-01-12 16:20                         ` Paul E. McKenney
2009-02-05  0:17                       ` Johannes Berg
2009-02-05  8:46                         ` Andi Kleen
2009-02-07 12:26                         ` Jörn Engel
2009-01-11  3:13                   ` Theodore Tso
2009-01-10 22:26                 ` Andi Kleen
2009-01-11  8:20                   ` Jörn Engel [this message]
2009-01-11 18:23                     ` Andi Kleen
2009-01-17 17:53 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090111082010.GA30090@logfs.org \
    --to=joern@logfs.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=johannes@sipsolutions.net \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox