Author: tridge Date: 2005-08-30 01:51:36 +0000 (Tue, 30 Aug 2005) New Revision: 9773
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9773 Log: [EMAIL PROTECTED]: 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 Modified: branches/SAMBA_4_0/ branches/SAMBA_4_0/source/lib/tdb/common/tdb.c Changeset: Property changes on: branches/SAMBA_4_0 ___________________________________________________________________ Name: svk:merge - a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11592 + a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11599 Modified: branches/SAMBA_4_0/source/lib/tdb/common/tdb.c =================================================================== --- branches/SAMBA_4_0/source/lib/tdb/common/tdb.c 2005-08-30 01:19:41 UTC (rev 9772) +++ branches/SAMBA_4_0/source/lib/tdb/common/tdb.c 2005-08-30 01:51:36 UTC (rev 9773) @@ -1276,14 +1276,22 @@ 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; + } } }