Hopefully I'm not picking at a scab here. I updated the dbm.sqlite
module in the sandbox. It now orders by rowid instead of by key.
(I saw no performance penalty for the small table sizes I was using
to ordering. I switched from ordering by key to ordering by rowid
based on Gerhard's comment.
I got a big performance boost on writes by only committing once every
100 calls to __setitem__. I still commit when deleting keys and
explicitly commit when closing.
The main performance bottleneck now appears to be keys() and iterkeys().
I don't see how to make them any simpler. Oddly enough, it seems
that iterkeys() is slower than keys(). Maybe it's just lack of sleep
but I can't see why this is so.