Subject: Re: CVS commit: src/sys/lib/libkern
To: None <source-changes@NetBSD.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: source-changes
Date: 11/22/2007 14:57:31
On Thu, Nov 22, 2007 at 05:00:32PM +1300, David Sainty wrote:
> It is also often cheaper to insert, and modify the existing node if
> present rather than query before insert, and then repeat the lookup for
> the insert operation too. It's also more "atomic friendly" than query +
> insert, should the tree be doing its own locking.

I guess the critical question here is: how much overhead do you have in
preparing the new node. As soon as you have to allocate memory, just
checking for dups first is way cheaper. That's what makes me believe
that a simple boolean that tells "I was successful" is good enough.

Joerg