This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Claudiu.Popa
Recipients Arfrever, Claudiu.Popa, Jim.Jewett, ncoghlan, python-dev, serhiy.storchaka
Date 2014-05-13.11:42:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1399981359.87.0.906212525771.issue19385@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2014-05-13 11:42:40Claudiu.Popasetrecipients: + Claudiu.Popa, ncoghlan, Arfrever, python-dev, Jim.Jewett, serhiy.storchaka
2014-05-13 11:42:39Claudiu.Popasetmessageid: <1399981359.87.0.906212525771.issue19385@psf.upfronthosting.co.za>
2014-05-13 11:42:39Claudiu.Popalinkissue19385 messages
2014-05-13 11:42:39Claudiu.Popacreate