diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-30 01:51:36 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:59 -0500 |
commit | cae788d5608b287b2c970ab28c0361350a5c7e95 (patch) | |
tree | cb8138948fe87baf4385eac6a23f506f2f3965a7 /source4/lib/tdb | |
parent | 6f9b901fa0db18faae603db67d8d31e229d92c27 (diff) | |
download | samba-cae788d5608b287b2c970ab28c0361350a5c7e95.tar.gz samba-cae788d5608b287b2c970ab28c0361350a5c7e95.tar.bz2 samba-cae788d5608b287b2c970ab28c0361350a5c7e95.zip |
r9773: r11599@blu: tridge | 2005-08-30 11:55:57 +1000
optimise this case a bit more. The total speedup using non-indexed
ldbtest is now around a factor of 80x. The code is ugly as hell, but
I think this speed is worth it.
Of course, if we only ever do indexed searches in ldb then this
doesn't help, but it seems all too common that we get unindexable
searches, so the optimisation is worthwhile
(This used to be commit 2e14fb893dd9815cdb2488c630131dc549e5c361)
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r-- | source4/lib/tdb/common/tdb.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source4/lib/tdb/common/tdb.c b/source4/lib/tdb/common/tdb.c index 8e8e3ce3b3..d6861efe13 100644 --- a/source4/lib/tdb/common/tdb.c +++ b/source4/lib/tdb/common/tdb.c @@ -1276,14 +1276,22 @@ static int tdb_next_lock(TDB_CONTEXT *tdb, struct tdb_traverse_lock *tlock, semantics don't change. With a non-indexed ldb search this trick gains us a - factor of more than 10 in speed on a linux 2.6.x - system. + factor of around 80 in speed on a linux 2.6.x + system (testing using ldbtest). */ if (!tlock->off && tlock->hash != 0) { u32 off; - if (ofs_read(tdb, TDB_HASH_TOP(tlock->hash), &off) == 0 && - off == 0) { - continue; + if (tdb->map_ptr) { + for (;tlock->hash < tdb->header.hash_size;tlock->hash++) { + if (0 != *(u32 *)(TDB_HASH_TOP(tlock->hash) + (unsigned char *)tdb->map_ptr)) { + break; + } + } + } else { + if (ofs_read(tdb, TDB_HASH_TOP(tlock->hash), &off) == 0 && + off == 0) { + continue; + } } } |