basic benchmark

A basic benchmark, consisting of a small template
that does a variety of standard templating tasks such as looping,
calling nested and external sub-templates, escaping of data, etc.
For each run, time is averaged over 2000 renderings, and the
best time of 4 runs is retained.
All times are in ms.
What you should want is automatic quoting and less time.

quoting qpy 1.7 evoque 0.4 mako 0.2.4 genshi 0.5.1
automatic 0.104 0.339 0.421 2.706 (c)
automatic R(a) 0.386
manual 0.318 (b) 0.387
none 0.262 0.308

(a) Restricted —
qpy 1.7 /
mako 0.2.4 /
genshi 0.5.1
offer no support for restricted execution or sandboxing
(b) manual quoting implies no qpy
(c) xml mode

Inspiration for this benchmark is from the basic benchmark proposed
by Genshi.

template and data

The (automatically quoted) evoque templates.

template.html

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
  <title>${title}</title>
</head>
<body>
$evoque{header.html}
 
$begin{greeting}<p>Hello, ${you}!</p>$end{greeting}

$evoque{#greeting, you=user}
$evoque{#greeting, you="me"}
$evoque{#greeting, you="world"}

<h2>Loop</h2>
$if{items}
    <ul>
    $for{idx, item in enumerate(items)}
        #[ 
          An alternative to the expression below could also be an inlined
          if statement (that many templating systems are unable to do), such as:
              $if{idx+1==len(items)} class="last"$fi 
          but it evaluates a little slower 
        ]#
        <li${idx+1==len(items) and " class='last'" or ""}>${item}</li>
    $rof
    </ul>
$fi

$evoque{footer.html}
$test{ title='Just a test', user='joe', items=['a', '<b/>', 'c'] }
</body>
</html>

header.html

<div id="header">
  <h1>${title}</h1>
</div>

footer.html

<div id="footer"></div>
DATA = dict(title='Just a test', user='joe', 
            items=['<n>%d</n>' % (num)  for num in range(1, 15)])

platform

The actual times are coming off a
MacBook Pro with 2.4 GHz Intel Core 2 Duo, 2 GB of RAM,
and Mac OS X 10.5, running Python 2.6.1.

caution

Please remember that performance benchmarks are only relevant
when considered within an entire context, and they may vary
enormously between different combinations of hardware and software,
even if those difference may appear to be very slight.
In addition, two different systems
never quite do precisely the same thing,
however simple and apparently identical the timed task may be.