Small tdb optimization

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Dec 19 05:55:32 MST 2011

On Mon, Dec 19, 2011 at 12:24:31PM +1030, Rusty Russell wrote:
> On Thu, 15 Dec 2011 12:18:57 +0100, Volker Lendecke <Volker.Lendecke at SerNet.DE> wrote:
> Non-text part: multipart/mixed
> > Hi, Rusty!
> > 
> > Attached find a small modification that might show some
> > speedup for large (i.e. ldb index) records.
> > 
> > The same would need to be applied to tdb2/tdb1_tdb.c if
> > accepted.
> > 
> > With best regards,
> I like it; I think saving the malloc & copy is better than avoiding two
> copies into the mmap.  I think the dbuf.dsize != 0 check is unnecessary
> though.

Ok. Can you give me a hint how I can build tdb2, so that I
can at least compile the equivalent change in tdb1_tdb.c?

Attached find another optimization: Using tdb_parse_record
we can avoid a malloc/memcpy/free in tdb_update_hash. Might
help large records like ldb indexes as well. Haven't run
make test on it yet, but I wanted to present the idea


SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen, mailto:kontakt at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tdb-Use-tdb_parse_record-in-tdb_update_hash.patch
Type: text/x-diff
Size: 1816 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list