Claudiu.Popa added the comment:

Right, my benchmark was indeed flawed. Here are the new results on my machine:

Without the patch
# ./python -S -m timeit -n 100000 -s "import dbm.dumb as dbm; 
d=dbm.open('x.dat', 'c')"  "len(d)"
100000 loops, best of 3: 0.564 usec per loop

With the patch
# ./python -S -m timeit -n 100000 -s "import dbm.dumb as dbm; 
d=dbm.open('x.dat', 'c')"  "len(d)"
100000 loops, best of 3: 0.857 usec per loop

Even having an empty _verify_open in __len__ method leads to this:

# ./python -S -m timeit -n 100000 -s "import dbm.dumb as dbm; 
d=dbm.open('x.dat', 'c')"  "len(d)"
100000 loops, best of 3: 0.749 usec per loop

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19385>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to