[Zope3-checkins] SVN: Zope3/trunk/src/zope/tal/ The lists has
been changed to dicts for faster membership testing
Dmitry Vasiliev
lists at hlabs.spb.ru
Fri Apr 22 10:32:37 EDT 2005
Stephan Richter wrote:
> On Thursday 21 April 2005 12:10, Dmitry Vasiliev wrote:
>
>>Log message for revision 30078:
>> The lists has been changed to dicts for faster membership testing
>
> Did you do some profiling to see how much faster it is?
I've just made some benchmarks with the following code:
import sys
from timeit import Timer
from zope.tal.htmltalparser import HTMLTALParser
fn = sys.argv[1]
print "Template:", fn
timer = Timer("HTMLTALParser().parseString(data)",
"""
from __main__ import fn, HTMLTALParser
data = open(fn, 'rb').read()
""")
print timer.repeat(number=1000)
For zope/app/apidoc/ifacemodule/index.pt template I've got the following results:
Old code (with lists):
[29.604110019569525, 29.467640440335295, 29.480704670565679]
New code (with dicts):
[29.188246830253565, 29.027186136785541, 29.018876700809741]
--
Dmitry Vasiliev (dima at hlabs.spb.ru)
http://hlabs.spb.ru
More information about the Zope3-Checkins
mailing list