tdb2: don't start again when we coalesce a record.
We currently start walking the free list again when we coalesce any record; this is overzealous, as we only care about the next record being blatted, or the record we currently consider "best". We can also opportunistically try to add the coalesced record into the new free list: if it fails, we go back to the old "mark record, unlock, re-lock" code. Before: $ time ./growtdb-bench 250000 10 > /dev/null && ls -l /tmp/growtdb.tdb && time ./tdbtorture -s 0 && ls -l torture.tdb && ./speed --transaction 2000000 real 1m0.243s user 0m13.677s sys 0m4.336s -rw------- 1 rusty rusty 683302864 2011-04-27 21:03 /tmp/growtdb.tdb testing with 3 processes, 5000 loops, seed=0 OK real 1m24.074s user 0m0.344s sys 0m0.468s -rw------- 1 rusty rusty 836040 2011-04-27 21:04 torture.tdb Adding 2000000 records: 1015 ns (110551992 bytes) Finding 2000000 records: 641 ns (110551992 bytes) Missing 2000000 records: 445 ns (110551992 bytes) Traversing 2000000 records: 439 ns (110551992 bytes) Deleting 2000000 records: 807 ns (199517112 bytes) Re-adding 2000000 records: 851 ns (199517112 bytes) Appending 2000000 records: 1301 ns (376542552 bytes) Churning 2000000 records: 2423 ns (553641304 bytes) After: $ time ./growtdb-bench 250000 10 > /dev/null && ls -l /tmp/growtdb.tdb && time ./tdbtorture -s 0 && ls -l torture.tdb && ./speed --transaction 2000000 real 0m57.403s user 0m11.361s sys 0m4.056s -rw------- 1 rusty rusty 689536976 2011-04-27 21:10 /tmp/growtdb.tdb testing with 3 processes, 5000 loops, seed=0 OK real 1m24.901s user 0m0.380s sys 0m0.512s -rw------- 1 rusty rusty 655368 2011-04-27 21:12 torture.tdb Adding 2000000 records: 941 ns (110551992 bytes) Finding 2000000 records: 603 ns (110551992 bytes) Missing 2000000 records: 428 ns (110551992 bytes) Traversing 2000000 records: 416 ns (110551992 bytes) Deleting 2000000 records: 741 ns (199517112 bytes) Re-adding 2000000 records: 819 ns (199517112 bytes) Appending 2000000 records: 1228 ns (376542552 bytes) Churning 2000000 records: 2042 ns (553641304 bytes)
Showing
Please register or sign in to comment