shelve slow in python 2.3.3 for windows

K

kramb64

I already submitted a bug, but I'm curious to know if anybody ran into
this.
Try this program on Windows with python 2.3.3 and with python 2.2:

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

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

Ciao.
Marco.
 
S

Skip Montanaro

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
 
K

kramb64

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,
you are right!

Under 2.3.3: 'dbhash'

Under 2.2: 'bsddb185'

Now the question is: is it possible to use bsddb185 with python 2.3.3?

Thanks.
Ciao.
Marco.
 
S

Skip Montanaro

Marco> Skip,
Marco> you are right!

Sort of.

Marco> Under 2.3.3: 'dbhash'

Marco> Under 2.2: 'bsddb185'

'dbhash' and 'bsddb185' are really the same beast.

Marco> Now the question is: is it possible to use bsddb185 with python
Marco> 2.3.3?

You're barking up the wrong tree. That's not the problem.

Skip
 
K

Kramb

'dbhash' and 'bsddb185' are really the same beast.

Marco> Now the question is: is it possible to use bsddb185 with python
Marco> 2.3.3?

You're barking up the wrong tree. That's not the problem.

So you're telling me that dbhash (namely /python2.3/DLLs/_bsddp.pyd)
on python 2.3.3 for Windows has a problem?
 
S

Skip Montanaro

Skip> 'dbhash' and 'bsddb185' are really the same beast.

Marco> Now the question is: is it possible to use bsddb185 with python
Marco> 2.3.3?

Skip> You're barking up the wrong tree. That's not the problem.

Marco> So you're telling me that dbhash (namely
Marco> /python2.3/DLLs/_bsddp.pyd) on python 2.3.3 for Windows has a
Marco> problem?

It would seem so. See my most recent post to your bug report. Switching
between bsddb.hashopen and bsddb.btopen seems to make a huge difference.

Skip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,176
Messages
2,570,949
Members
47,500
Latest member
ArianneJsb

Latest Threads

Top