durusmail: qp: RELEASED: Updates of Durus, QP, Qpy, Sancho, and Dulcinea
RELEASED: Updates of Durus, QP, Qpy, Sancho, and Dulcinea
2008-12-03
2008-12-04
2009-01-10
2009-01-10
RELEASED: Updates of Durus, QP, Qpy, Sancho, and Dulcinea
Mario Ruggier
2009-01-10
On Dec 4, 2008, at 2:11 AM, Michael Watkins wrote:

> I've not had time to see what changed in Python 2.6 to produce
> better QPY
> template performance:
>
> mw@frog$ python2.5 bigtable.py
> ElementTree                         736.43 ms
> cStringIO                            36.46 ms
> StringIO                            141.10 ms
> list concat                          22.73 ms
> QPY Template                        129.35 ms
>
> mw@frog$ python2.6 bigtable.py
> ElementTree                         656.99 ms
> cStringIO                            30.85 ms
> StringIO                            131.95 ms
> list concat                          16.37 ms
> QPY Template                         39.54 ms


Interesting... running the 3 benchmarks included with evoque also
confirms a big increase in 2.6, even if maybe not as dramatic as what
you observe.

In these 3 benchmarks, the "mq" means "manual quoting" -- and for this
one qpy is not used at all (uses cgi.escape to do the quoting). In all
cases, the bulk of evoque's work is achieved via eval(). The "nqt"
means "no quoting tweaked", probably similar to your "list concat".
For more details on each of these benchmark, see:
http://evoque.gizmojo.org/benchmark/

Interesting to note is that the gains seems to be consistent across
the board (qpy gains are always the highest though).

Also, for the subs bench (only string substitutions) we can also
compare to pystr_nq (python template.String) -- that does less than
the others as it does "no quoting". Surprisingly, it seems to get
slower in 2.6...


$ python2.5 bench/bigtable.py qpy evoque evoque_mq
qpy:              55.85 ms
evoque:           99.27 ms
evoque_mq:        86.29 ms
evoque_nqt:        9.13 ms

$ python2.6 bench/bigtable.py qpy evoque evoque_mq
qpy:              30.82 ms
evoque:           57.57 ms
evoque_mq:        57.13 ms
evoque_nqt:        8.18 ms


$ python2.5 bench/basic.py qpy evoque evoque_mq
qpy:               0.20 ms
evoque:            0.48 ms
evoque_mq:         0.42 ms

$ python2.6 bench/basic.py qpy evoque evoque_mq
qpy:               0.10 ms
evoque:            0.35 ms
evoque_mq:         0.32 ms


$ python2.5 bench/subs.py pystr_nq qpy evoque evoque_mq
pystr_nq:          0.05 ms
qpy:               0.05 ms
evoque:            0.05 ms
evoque_mq:         0.05 ms

$ python2.6 bench/subs.py pystr_nq qpy evoque evoque_mq
pystr_nq:          0.06 ms
qpy:               0.03 ms
evoque:            0.04 ms
evoque_mq:         0.04 ms


reply