SpeedyB

Introduction

speedyb lets you create and read constant databases. Let's say you have a dict like this:
d = {
  'Alice': '26 Pine Street',
  'Bob':   '54 Oak Drive'
}
You can write this to a database file:
speedyb_writer.dict_to_file(d, 'my.db')

Download

Python package - create and read SpeedyB: speedyb-0.1.tar.gz
Perl package - read SpeedyB only: http://search.cpan.org/~ablum/DB-SPEEDYB-0.1/SPEEDYB.pod

Questions

Q: Why not store the dict in a JSON or pickle file and read into a python dict?
A: First, each process that loads the dict would allocate separate memory, while speedyb shares the memory. Second, for a large db the load time can be significant, while with speedyb it is essentially instant.
Q: How does speedyb compare to Berkeley DB, LevelDB, etc?
A: It is significantly faster because it's constant.

Installation

Checkout the source and run ``python setup.py install``.

Using SpeedyB

Creating a DB from Python

  import speedyb_writer
  d = { ... } # data to store
  speedyb_writer.dict_to_file(d, 'new.db')
This creates a new database file containing d. It may be slow. File creation time goes up linearly with number of keys in d.

Reading a DB from Python

  from speedyb_reader import speedyb_reader
  db = speedyb_reader('tiny.tmp') # open file
  res = db.get('Alice') # lookup a key
If the key is not present, res is None.
by asher@wildsparx.com