2 ms·
Yeah I tried that myself - I took that benchmark script and changed the CREATE TABLE lines to look like this (adding the primary key): CREATE TABLE store(k
by simonw 4y ago
Yeah I tried that myself - I took that benchmark script and changed the CREATE TABLE lines to look like this (adding the primary key):
CREATE TABLE store(key TEXT PRIMARY KEY, value TEXT)
Here are the results before I made that change:
sqlite
Took 0.032 seconds, 3.19541 microseconds / record
dict_open
Took 0.002 seconds, 0.20261 microseconds / record
dbm_open
Took 0.043 seconds, 4.26550 microseconds / record
sqlite3_mem_open
Took 2.240 seconds, 224.02620 microseconds / record
sqlite3_file_open
Took 7.119 seconds, 711.87410 microseconds / record
And here's what I got after adding the primary keys:
sqlite
Took 0.040 seconds, 3.97618 microseconds / record
dict_open
Took 0.002 seconds, 0.19641 microseconds / record
dbm_open
Took 0.042 seconds, 4.18961 microseconds / record
sqlite3_mem_open
Took 0.116 seconds, 11.58359 microseconds / record
sqlite3_file_open
Took 5.571 seconds, 557.13968 microseconds / record
My code is here: https://gist.github.com/simonw/019ddf08150178d49f4967cc383563ea https://gist.github.com/simonw/019ddf08150178d49f4967cc38356...
- divbzero 4y agoJust to spell out the results: Adding the primary key appears to improve SQLite performance but still falls short of DBM.
- cbdumas 4y agoYeah now that I dig in a little further it looks like it's not as clear cut as I thought. DBM read performance is better for me with larger test cases than I was initially using, though I am getting some weird performance hiccups when I use very large test cases. It looks like I'm too late to edit my top level response to reflect that.