[Baypiggies] Major improvements to XML/XHTML handling in Pycopia
Shannon -jj Behrens
jjinux at gmail.com
Thu Jun 21 10:38:47 CEST 2007
On 6/20/07, Keith Dart <keith at dartworks.biz> wrote:
> I've just completed a major overhaul of the XML/XHTML portions of
> Pycopia. It now handles various encodings and languages much better,
> and is also much faster. Some of the XHTML modules has been refactored
> into the XML module.
>
> The Mako benchmark shows about a 150% speed improvement in simple page
> rendering:
>
> 891 $ python basic.py mako django genshi Pycopia pyNMS
> Mako: 0.45 ms
> Django: 1.33 ms
> Genshi: 5.24 ms
> Pycopia: 2.69 ms
> Pynms: 4.44 ms
>
> This shows basic page rendering times. Mako and Django are templating
> systems so parts of the page are static. Genshi, PyNMS, and Pycopia
> are purely dynamic, pure Python page generators. However, the Pycopia
> and PyNMS generators also do on-the-fly attribute validation of the
> page. Pycopia is now almost twice as fast as Genshi, and more
> featureful also. For example, only Pycopia can generate correct WML
> pages in pure Python.
>
> It is now possible to do encoding translations. Fetch a document in
> one encoding, and write it in another. For example, read a shiftjis
> and write a utf-8 page, or vice-versa (as long as the charset maps).
>
> Support for all the major XHTML and WML flavors is also there,
> including XHTML 1.1, XHTML mobile 2.0, and WML 2.0. The parser does
> partial validation of same when parsing (tag and attribute names), and
> generating. The system is semantically idempotent.
I don't have anything against Pycopia, but as a general statement, *I
love Genshi*! The match/xpath mechanism lets me code a generic look
and feel and have multiple layers of code (project, section,
department, whatever) that customize that look and feel. It's like a
version of XSLT that's suddenly both friendly and performant.
Furthermore, I can't mostly ignore XSS problems. I've used a lot of
templating languages over the years, but Genshi has definitely been my
favorite.
As for performance, I just don't care. Genshi improves my
productivity, and templating engines running on Web servers are
horizontally scalable. It'd have to be another order of magnitude
slower before I'd start worrying about it.
Happy Hacking!
-jj
--
http://jjinux.blogspot.com/
More information about the Baypiggies
mailing list