]> git.ozlabs.org Git - ccan/commit
tdb2: speed up transaction code by making page size a constant.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 25 Mar 2011 05:42:03 +0000 (16:12 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 25 Mar 2011 05:42:03 +0000 (16:12 +1030)
commitb556ef1fc167e1010b07df5ebd75d808cc30f970
treef0c173b3c9ad068b5b9f40fae401e38046df5c91
parent1444b09cd357c145b6e3fdb1bce3b6ace6862f56
tdb2: speed up transaction code by making page size a constant.

Turning getpagesize() into a constant 4096 really helps gcc optimize, and
not just on 64 bit.

Here are the results of running "tools/speed --transaction --no-sync 2000000":

i386 with gcc 4.4.5:
Before:
$ ./speed --transaction --no-sync 2000000
Adding 2000000 records:  1195 ns (93594224 bytes)
Finding 2000000 records:  719 ns (93594224 bytes)
Missing 2000000 records:  429 ns (93594224 bytes)
Traversing 2000000 records:  523 ns (93594224 bytes)
Deleting 2000000 records:  901 ns (93594224 bytes)
Re-adding 2000000 records:  1032 ns (93594224 bytes)
Appending 2000000 records:  1711 ns (182801232 bytes)
Churning 2000000 records:  3233 ns (182801232 bytes)

After:
Adding 2000000 records:  868 ns (93594224 bytes)
Finding 2000000 records:  569 ns (93594224 bytes)
Missing 2000000 records:  369 ns (93594224 bytes)
Traversing 2000000 records:  406 ns (93594224 bytes)
Deleting 2000000 records:  674 ns (93594224 bytes)
Re-adding 2000000 records:  730 ns (93594224 bytes)
Appending 2000000 records:  1144 ns (182801232 bytes)
Churning 2000000 records:  2085 ns (182801232 bytes)

Here's the effect (average of 10) on x8664 with gcc 4.1.2, with an earlier
tree and 1000000:
Before:
Adding 830.1ns
Finding 428.3ns
Missing 250.3ns
Traversing 387.4ns
Deleting 588.8ns
Re-adding 737.2ns
Appending 1141.4ns
Churning 1792ns

After:
Adding 562.8ns
Finding 362.1ns
Missing 226.4ns
Traversing 276.5ns
Deleting 426.7ns
Re-adding 489.8ns
Appending 736.4ns
Churning 1112.7ns
ccan/tdb2/transaction.c