[pypy-dev] sys._getframe(1).f_locals is very slow on PyPy 1.8

Makoto Kuwata kwa at kuwata-lab.com
Sun May 27 23:43:04 CEST 2012


On Mon, May 28, 2012 at 3:01 AM, Maciej Fijalkowski <fijall at gmail.com> wrote:
> On Sun, May 27, 2012 at 2:53 PM, Makoto Kuwata <kwa at kuwata-lab.com> wrote:
>>
>> On Sun, May 27, 2012 at 9:35 PM, Alex Gaynor <alex.gaynor at gmail.com>
>> wrote:
>> >
>> > If this is a template engine there's no reason you have to implement
>> > scope
>> > using python's scope directly, both Django, Jinja, and others implement
>> > a
>> > different scoping system on top of Pythons.
>> >
>>
>> Of course it is possible, and that is one of the reason why other
>> template engines
>> (such as Django or Jinja2) are very fat and slower than my Tenjin.
>> There are some approaches to implement template engine.
>> My approach is different from Djang or Jinja2. It's that easy.
>
>
> I seriously have to say [citation needed]. Do you have benchmark figures?
> I'm especially interested in jinja2 and spitfire (spitfire is quite fast).


Template engine benchmarking is not the point of current discussion,
but if you are interested in it, try:

  $ wget http://pypi.python.org/packages/source/T/Tenjin/Tenjin-1.1.1.tar.gz
  $ tar xf Tenjin-1.1.1.tar.gz
  $ cd Tenjin-1.1.1/benchmark
  $ easy_install Tenjin Mako Jinja2 Django Templetor Cheetah Genshi Kid
  $ python bench.py -h
  $ python bench.py -q -n 10000

Here is an example of benchmark result (on CPython):

  http://www.kuwata-lab.com/tenjin/pytenjin-users-guide.html#benchmark
  http://www.kuwata-lab.com/tenjin/
  http://www.slideshare.net/kwatch/how-to-create-a-highspeed-template-engine-in-python
(page 5)

This shows that Tenjin is:
  * twice faster than Mako or Jinja2
  * twenty times faster than Django

(Sorry I don't know Spitfire.)

--
regards,
makoto kuwata


More information about the pypy-dev mailing list