[Chicago] help from Django and Pylons developers
Ian Bicking
ianb at colorstudy.com
Mon Apr 28 21:30:02 CEST 2008
Massimo Di Pierro wrote:
> The speedup is not because of the bytecode compilation. But in order to
> bytecode compile web2py parses the templates and resolves all the
> includes and extend thus turning the entire template hierarchy for each
> page into a single python file which is then bytecode compiled. My users
> see a lot of speedup. In particular those users who run on smartphones
> and other platforms like the Nokia N800. I do not know whether Make does
> the same (that is why I asked) but probably now if you say there is no
> speed-up.
Mako doesn't resolve inheritance into a single file, but that's just a
single function call overhead. There's lots of possible performance
hacks along those lines in Python, some of which are helpful and some of
which aren't that helpful. I would be quite surprised if that
particular optimization is noticeable. Mako does bytecode compile all
components that make up a template.
If you want to measure performance, then measure performance. The
Genshi people have set up some common benchmark infrastructure for
Python templating languages, you could get web2py's templating language
setup in that system. If you are particularly interested in performance
it could be a useful basis for improving performance (which was the
original reason for setting it up, as Genshi developers wanted some
baseline for measuring their own performance improvements).
Another concern is the debuggability of templates: how do they show up
in tracebacks? I consider this a fairly important feature of templating
languages. From what I saw in web2py, it looks like you have to infer
the corresponding template code from the Python translated source. Mako
doesn't make this compromise, even for compiled templates, and so among
other things it can't compile multiple files down to a single file.
> I updated the document based on your original comments but I have a
> philosophical question: if a feature is not documented and there is no
> example, is it really there?
Well, it is documented *somewhere*. Pylons does have a problem with
fractured documentation, spread out over several projects. I won't
argue with that criticism, and there is effort going on to fix this.
But if you remove every feature with no easily accessible documentation,
then Pylons kind of disappears ;)
--
Ian Bicking : ianb at colorstudy.com : http://blog.ianbicking.org
More information about the Chicago
mailing list