Testing SQLite vs. Tokyo Cabinet (TC) vs. G-WAN's KV store


Preparing data for 10 rounds * 1,000 items = 10,000 operations per engine

Tokyo Cabinet fails because of locking errors at 10,000+ items because TC databases can either
be opened for READ or WRITE mode but not both.

sprintf() Overhead: 1,000 entries processed in 0.28500 ms
Random Overhead: 1,000 entries processed in 0.02100 ms

engineinsertrandom insertrandom updatetraversein-order searchrandom searchdeletewipe alltotal time
SQLite16.03913.78913.7890.30318.99618.9401.3051.23384.393
G-WAN vs SQLite119.429x faster105.906x faster134.657x faster29.960x faster324.718x faster298.263x faster14.693x faster28.023x faster211.406x faster
TC1.7520.1660.1345.0580.6730.6712.0832.08312.321
G-WAN vs TC13.048x faster1.273x faster1.313x faster500.822x faster11.504x faster10.569x faster23.459x faster47.345x faster30.864x faster
TC-FIXED0.1020.0960.0850.1130.2550.2690.1830.1831.104
G-WAN vs TC-FIXED1.318x slower1.356x slower1.200x slower11.198x faster4.359x faster4.228x faster2.056x faster4.150x faster2.765x faster
G-WAN0.1340.1300.1020.0100.0590.0640.0890.0440.399
(times per item operation in milliseconds, TC-FIXED 'wipe all' time [I/O is done there] is replaced by smaller 'delete' time)

Explaining the Results:

TC and TC-FIXED inserts are fast because TC's hash-table and TC-FIXED's array are pre-allocated
before any item can be added (by contrast, G-WAN's KV allocates memory on-demand). Pre-allocating
all the memory helps to shine in benchmarks but real-life applications may take months to fill these data
structures (if it ever happens), wasting previous memory that the system and other applications could
better use.

About the "Total Time":

G-WAN's KV store is 20-30x faster than Tokyo Cabinet "TC" (hash-table of variable-size keys/values).
G-WAN's KV store is 2-3x faster than Tokyo Cabinet "TC-FIXED" (an array of fixed-size keys/values).

Concurrency Issues:

Unlike TC, TC-FIXED and SQLite (where an insert/update blocks all other read & write threads),
G-WAN's Key-Value store is wait-free (it never blocks and it never delays any mix and number of
reads and writes).

G-WAN's Key-Value store ability to create indexes on existing data lets you continue using the same
indexed-model that everybody used during decades - just much faster.