summaryrefslogtreecommitdiff
path: root/lib/ntdb/private.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-19 12:43:09 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-19 05:38:07 +0200
commitb888bc4316f3f9c74b6768ddb1db1ec8fbac975e (patch)
tree265f0b7f53ceb5959dd32bd5698f8bb4665bfe17 /lib/ntdb/private.h
parent8fdd20b22f6b27b616b5b3a2285a267ffae0a262 (diff)
downloadsamba-b888bc4316f3f9c74b6768ddb1db1ec8fbac975e.tar.gz
samba-b888bc4316f3f9c74b6768ddb1db1ec8fbac975e.tar.bz2
samba-b888bc4316f3f9c74b6768ddb1db1ec8fbac975e.zip
ntdb: optimize ntdb_fetch.
We access the key on lookup, then access the data in the caller. It makes more sense to access both at once. We also put in a likely() for the case where the hash is not chained. Before: Adding 1000 records: 3644-3724(3675) ns (129656 bytes) Finding 1000 records: 1596-1696(1622) ns (129656 bytes) Missing 1000 records: 1409-1525(1452) ns (129656 bytes) Traversing 1000 records: 1636-1747(1668) ns (129656 bytes) Deleting 1000 records: 3138-3223(3175) ns (129656 bytes) Re-adding 1000 records: 3278-3414(3329) ns (129656 bytes) Appending 1000 records: 5396-5529(5426) ns (253312 bytes) Churning 1000 records: 9451-10095(9584) ns (253312 bytes) smbtorture results (--entries=1000) ntdb speed 183881-191112(188223) ops/sec After: Adding 1000 records: 3590-3701(3640) ns (129656 bytes) Finding 1000 records: 1539-1605(1566) ns (129656 bytes) Missing 1000 records: 1398-1440(1413) ns (129656 bytes) Traversing 1000 records: 1629-2015(1710) ns (129656 bytes) Deleting 1000 records: 3118-3236(3163) ns (129656 bytes) Re-adding 1000 records: 3235-3355(3275) ns (129656 bytes) Appending 1000 records: 5335-5444(5385) ns (253312 bytes) Churning 1000 records: 9350-9955(9494) ns (253312 bytes) smbtorture results (--entries=1000) ntdb speed 180559-199981(195106) ops/sec
Diffstat (limited to 'lib/ntdb/private.h')
-rw-r--r--lib/ntdb/private.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ntdb/private.h b/lib/ntdb/private.h
index 957d85e494..90b782d303 100644
--- a/lib/ntdb/private.h
+++ b/lib/ntdb/private.h
@@ -369,7 +369,8 @@ ntdb_off_t find_and_lock(struct ntdb_context *ntdb,
NTDB_DATA key,
int ltype,
struct hash_info *h,
- struct ntdb_used_record *rec);
+ struct ntdb_used_record *rec,
+ const char **rkey);
enum NTDB_ERROR replace_in_hash(struct ntdb_context *ntdb,
const struct hash_info *h,