Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wonder if it's still faster than sqlite in 2022.


The 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


According 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


I think on Linux is often GNU DBM, Berkeley DB is a different, better implementation by Oracle that requires a third party module.


...it's... Better?

But... It's Oracle...

https://youtu.be/-zRN7XLCRhc


Sorry if it's a dumb question but sinc dbm writes stuff to disk, how is that different than loading the pickles?


You 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.


Thank you!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: