From: Daniel Phillips <phillips@bonn-fries.net>
To: Richard Guenther <rguenth@tat.physik.uni-tuebingen.de>
Cc: "Brian J. Watson" <Brian.J.Watson@compaq.com>,
Larry McVoy <lm@bitmover.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Common hash table implementation
Date: Mon, 23 Jul 2001 16:36:06 +0200 [thread overview]
Message-ID: <01072316360604.00315@starship> (raw)
In-Reply-To: <Pine.LNX.4.21.0107221207460.3066-100000@bellatrix.tat.physik.uni-tuebingen.de>
In-Reply-To: <Pine.LNX.4.21.0107221207460.3066-100000@bellatrix.tat.physik.uni-tuebingen.de>
On Sunday 22 July 2001 12:18, Richard Guenther wrote:
> On Sat, 21 Jul 2001, Daniel Phillips wrote:
> > On Saturday 21 July 2001 02:24, Brian J. Watson wrote:
> > > Daniel Phillips wrote:
> > > Richard Guenther sent the following link to his own common
> > > hashing code, which makes nice use of pseudo-templates:
> > >
> > > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/glame/g
> > >lame /src/include/hash.h?rev=1.5&content-type=text/plain
> > >
> > > A few things I would consider changing are:
> > >
> > > - ditching the pprev pointer
> >
> > Yes, you want to use the generic list macros there.
>
> You get one-pointer size hash table entries and generic deletion from
> it.
Having thought about it a little more, I don't see why the symmetric
double link (i.e., like the page hash, not like the buffer hash)
couldn't be used with single-pointer tables, using similar tests for
NULL in insertion and deletion.
> > > - encapsulating the next pointer inside a struct
> > > hash_head_##FOOBAR
> >
> > I think the generic list macros give you that for free.
>
> Umm, if you use such, you get lists.h style type-casting stuff which
> doesnt have a nice interface as
You could wrap the final product in inlines with internal typecasts.
As you pointed out, C just doesn't have templates.
> > Naturally. And trying to reduce the size of the macros. It's not
> > that easy to get stuff that has dozens of lines ending with "\"
> > into the kernel. You might have better luck just generalizing a
> > few short sets of common operations used in hashes, and showing
> > examples of how you'd use them to rewrite some of the existing hash
> > code. Obviously, the new, improved approach has to be no less
> > efficient than the current way of doing things.
>
> All those \s are to encapsulate the whole thing into the
> template-style macro - not that I like this, but I cannot see an
> alternative.
An obvious alternative is to leave things the way they are. I've
noticed that this is a stance Linus typically adopts for improvements
that aren't clearly better in every way ;-)
--
Daniel
next prev parent reply other threads:[~2001-07-23 14:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-18 0:57 Common hash table implementation Brian J. Watson
2001-07-18 1:34 ` Larry McVoy
2001-07-18 13:46 ` Daniel Phillips
2001-07-21 0:24 ` Brian J. Watson
2001-07-21 20:25 ` Daniel Phillips
2001-07-22 10:18 ` Richard Guenther
2001-07-23 14:36 ` Daniel Phillips [this message]
2001-07-22 16:37 ` Larry McVoy
2001-07-23 14:24 ` Daniel Phillips
2001-07-22 23:34 ` Eyal Lebedinsky
2001-07-24 12:57 ` Daniel Phillips
2001-07-22 2:23 ` Rusty Russell
2001-07-24 12:28 ` Daniel Phillips
2001-07-18 9:48 ` Richard Guenther
[not found] <oupitgqjxoi.fsf@pigdrop.muc.suse.de>
2001-07-20 22:32 ` Brian J. Watson
2001-07-21 22:57 ` Daniel Phillips
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=01072316360604.00315@starship \
--to=phillips@bonn-fries.net \
--cc=Brian.J.Watson@compaq.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lm@bitmover.com \
--cc=rguenth@tat.physik.uni-tuebingen.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.