5 ms·
I wonder if it's still faster than sqlite in 2022.
by j0hnyl 4y ago
I wonder if it's still faster than sqlite in 2022.
- calpaterson 4y agoAccording to his benchmark run today on Python 3.9 on linux, dbm is still considerably faster for random access. That said, what database dbm is using varies a lot by platform. I think on linux it's usually BerkleyDB. I use dbm a lot to cache pickles of object that were slow to create. eg pandas dataframes
- curiousgal 4y agoSorry if it's a dumb question but sinc dbm writes stuff to disk, how is that different than loading the pickles?
- dfox 4y agoYou get one file for the whole store, not one per key. Also, it tends to better handle having lots of keys significantly better than filesystems handle lots of files in one directory.
- curiousgal 4y agoThank you!
- qalmakka 4y agoI think on Linux is often GNU DBM, Berkeley DB is a different, better implementation by Oracle that requires a third party module.
- chaxor 4y ago...it's... Better? But... It's Oracle... https://youtu.be/-zRN7XLCRhc https://youtu.be/-zRN7XLCRhc
- cbdumas 4y agoThe script linked at the bottom of this page uses sqlite without an index on the table. In my testing if you add an index sqlite quickly outperforms dbm in terms of read performance