shelve slow in python 2.3.3 for windows

Skip Montanaro skip at pobox.com
Wed Jan 21 16:47:20 EST 2004


    Marco> Try this program on Windows with python 2.3.3 and with python 2.2:

    Marco> import shelve 
    Marco> a=shelve.open("a", "c") 
    Marco> for x in xrange(10000): 
    Marco>      a[str(x)]=x 
    Marco>      print str(x) + "\r", 
    Marco> a.close() 

    Marco> After about 7000/8000 insertions, the program gets so slow...
    Marco> With python 2.2 it ends in a blink!
    Marco> Really strange, isn't it?

Perhaps not.  After running your script, what does

    whichdb.whichdb("a") 

report under both versions?  My wild-ass guess is that the underlying anydbm
module finds dumbdbm under 2.3.3 and something more industrial strength like
bsddb under 2.2.

Skip




More information about the Python-list mailing list