Performance

Warning

The master repository branch is a moving target. Please use PERF_BASELINE_FROM_DOCS Git tag to reproduce any results here. The host machine used for testing is a Core i7 975 @ 3.6ghz on Linux 3.10.

examples/benchy.py drives the library in some basic configurations, showing relative performance using the various engines available using a single thread.

  • Encoder: acid.encoders.make_msgpack_encoder()

  • Generates 236,000 200 byte dict records with 3 string keys and string values, third value containing 150 bytes mostly random data:

    {'stub': '1001155 [.....] 5273067200649406939020424757',
     'name': 'undergrown',
     'location': 'UNDERGROWN'}
    
  • Collection key_func returning two string values from the record:

    key_func = operator.itemgetter('name', 'location')
    
  • 2 1-tuple ~8 byte string index functions defined, each producing a single index entry per record:

    coll.add_index('rev_name', lambda p: p['name'][::-1])
    coll.add_index('rev_location', lambda p: p['location'][::-1])
    

Variant Explanations

indices
2 indices are maintained during insert: one of the lowercase version of the word, and one on the uppercase version. Insertion requires use of the replace, which may degrade to a get()/put() pair with some engines.
noindices
No index is maintained during insert. The resulting collection can only be searched by key. Insertion uses a plain put <acid.engines.Engine.put(), and does not need to observe any previously stored value.

Mode Explanations

insert
Insert all keys.
rand-index
Search for all records using an index, performing searches in random order.
rand-key
Search for all records using their key, performing searches in random order.
examples/benchy.py
Engine Mode Keys Time Ops/s
         
LmdbEngine insert-blind-noindices 235,886 1.34 176,367
LmdbEngine insert-blind-indices 707,658 2.13 332,173
LmdbEngine insert-noblind-noindices 235,886 1.33 353,740
LmdbEngine insert-noblind-indices 707,658 3.67 256,968
LmdbEngine rand-index 471,772 9.19 51,347
LmdbEngine rand-key 707,658 7.25 97,628
         
SkiplistEngine insert-blind-noindices 235,886 3.98 59,311
SkiplistEngine insert-blind-indices 707,658 11.46 61,749
SkiplistEngine insert-noblind-noindices 235,886 4.72 99,885
SkiplistEngine insert-noblind-indices 707,658 16.05 58,788
SkiplistEngine rand-index 235,886 8.55 27,600
SkiplistEngine rand-key 471,772 8.89 53,086
         
PlyvelEngine insert-blind-noindices 235,886 1.49 158,682
PlyvelEngine insert-blind-indices 707,658 2.75 257,231
PlyvelEngine insert-noblind-noindices 235,886 1.48 319,135
PlyvelEngine insert-noblind-indices 707,658 6.42 147,063
PlyvelEngine rand-index 235,886 8.24 28,630
PlyvelEngine rand-key 471,772 9.15 51,555
         
MongoEngine insert-blind-noindices 235,886 27.94 8,444
MongoEngine insert-blind-indices 707,658 34.13 20,732
MongoEngine insert-noblind-noindices 235,886 28.41 16,606
MongoEngine insert-noblind-indices 707,658 33.88 27,850
MongoEngine rand-index 235,886 33.25 7,094
MongoEngine rand-key 235,886 28.78 8,195

Batch compression

A run of examples/batch.py illustrates the tradeoffs of compression.

examples/batch.py with 777 1.51kb records.
Packer Size Count Ratio BatchSz Gets/sec Iters/sec Iterrecs/sec
               
plain 1168.68kb 777 1.00 1 108131.95 354.98 139716.02
zlib 665.24kb 777 1.76 1 42760.74 133.30 50555.17
zlib 606.23kb 391 1.93 2 29340.89 143.39 56638.37
zlib 559.32kb 198 2.09 4 19804.81 170.44 65492.69
zlib 546.68kb 160 2.14 5 17064.23 168.38 67426.26
zlib 523.11kb 102 2.23 8 12172.93 187.56 71960.91
zlib 492.75kb 54 2.37 16 6810.00 187.31 74794.60
zlib 467.64kb 30 2.50 32 3769.07 183.75 77812.57
zlib 451.92kb 18 2.59 64 2034.88 194.97 81139.05
               
plain 1168.68kb 777 1.00 1 107199.09 363.83 139657.54
snappy 956.01kb 779 1.22 1 92543.20 304.43 116504.26
snappy 877.93kb 393 1.33 2 70259.24 289.25 113377.84
snappy 812.97kb 200 1.44 4 53762.23 318.78 123968.52
snappy 795.32kb 162 1.47 5 46740.49 317.77 124612.58
snappy 764.59kb 104 1.53 8 35786.67 326.88 128425.48
snappy 726.76kb 56 1.61 16 21549.42 329.54 131490.48
snappy 698.78kb 32 1.67 32 12151.92 330.81 132927.23
snappy 693.17kb 20 1.69 64 6536.96 320.86 133595.61
               
plain 1168.68kb 777 1.00 1 106367.40 357.73 138651.79
lz4 958.01kb 779 1.22 1 98937.29 321.07 124096.64
lz4 884.88kb 393 1.32 2 77326.69 316.02 121574.12
lz4 821.37kb 200 1.42 4 65689.48 348.71 135687.07
lz4 803.58kb 162 1.45 5 59402.30 357.00 138203.87
lz4 769.61kb 104 1.52 8 48724.15 371.56 144024.33
lz4 729.24kb 56 1.60 16 32488.84 376.87 148202.87
lz4 702.82kb 32 1.66 32 19842.84 371.99 149982.37
lz4 702.67kb 20 1.66 64 11415.55 359.74 151281.18