This repo is meant as a place to track our progress in improving the performance of the database used for secure scuttlebutt.
Generate a dataset using ssb-fixures for testing:
npm run generate-data
This will create a database consisting of 100.000 fake messages, generated with a realistic distribution of the different kind of messages types and encrypted messages.
Optional, apply the aligned-block fix:
npm run aligned-block-fix
Finally run the benchmark:
npm run benchmark
On the first run, indexes will be created and this is mainly what we are interested in testing here. Subsequent will reuse the indexes so to run the index creating benchmark again, do a:
npm run clean-indexes
Comparing ssb-db 20.3 against ssb-db2 0.5.0, using ssb-fixtures 2.2.0 (no private groups) indexing 10.000 messages:
db1: 4.658s
db2: 939.209ms
roughly 4.9x speed up
Indexing 100.000 messages:
db1: 36.836s
db2: 4.994s
roughly 7.3x speed up
Indexing 1.000.000 messages:
db1: 4:23.873 (m:ss.mmm)
db2: 26.754s
roughly 9.89x speed up
Update 2022-05-31:
Ran indexing 100.000 messages again:
db2 1.1.0: 5.646s
db2 4.1.3: 4.517s
Roughly 20% faster
Note 1.1.0 is a bit slower than 0.5, but probably also with less bugs :)