Search code examples
pythonmmapshelvedbm

Does Python's shelve module use memory-mapped IO?


Does anyone know if Python's shelve module uses memory-mapped IO?

Maybe that question is a bit misleading. I realize that shelve uses an underlying dbm-style module to do its dirty work. What are the chances that the underlying module uses mmap?

I'm prototyping a datastore, and while I realize premature optimization is generally frowned upon, this could really help me understand the trade-offs involved in my design.


Solution

  • Existing dbm implementations in the Python standard library all use "normal" I/O, not memory mapping. You'll need to code your own dbmish implementation with memory mapping, and integrate it with shelve (directly, or, more productively, through anydbm).