• Guido van Rossum's avatar
    Interpreter for a pre-compiled TAL program. · f727f710
    Guido van Rossum authored
    This really makes a difference!  Some timing statistics (on
    test/test2.html, a document with no TAL contents):
    
    talizetree    :  2.190 secs for 10 calls, i.e.  219 msecs per call
    printtree     :  2.870 secs for 10 calls, i.e.  287 msecs per call
    compiletree   :  0.250 secs for 10 calls, i.e.   25 msecs per call
    interpretit   :  0.110 secs for 10 calls, i.e.   11 msecs per call
    
    There are two ways to go from a DOM tree to text (the assumption is
    that the DOM tree is already in memory):
    
    talize + print    : total 506 msec
    compile+interpret : total  36 msec, or about 14x faster
    
    If we cache the compiled program, we're down to 12 msec, or over 40x
    faster.
    
    So compilation + interpretation are well worth it!  (I.o.w., creating
    a DOM tree is very slow.)
    f727f710
TALInterpreter.py 8.09 KB