Re: Slow templates in py2exe

Aahz <[email protected]> Fri, 18 Sep 2009 10:45:46 -0700
Newsgroups gmane.comp.python.cheetah
Organization The Cat & Dragon
Message-ID <[email protected]>
On Fri, Sep 18, 2009, R. Tyler Ballance wrote:
> On Thu, 17 Sep 2009, Aahz wrote:
>>> My initial instinct is that py2exe is pulling in the Python version of
>>> the NameMapper, which is indeed slower than the C version. The
>>> NameMapper is what is responsible for mapping $myVar into the actual
>>> entity that it represents.
>>> 
>>> Do you have the compiled version of NameMapper installed? Do you know if
>>> py2exe is pulling it in?
>> 
>> Curioser and curioser, as Alice said.  AFAICT, there isn't any
>> _namemapper.pyd anywhere on the system.  (There's a _namemapper.so on my
>> Mac.)  There doesn't seem to be an official pyd for 2.6, should I use
>> http://feisley.com/python/cheetah/pyd2.2.1/py26/_namemapper.pyd
>> ?
> 
> Perhaps if you asked James nicely enough he could post a build of 2.0.1
> on Windows, the downside of this of course is that prior to v2.2.2
> Cheetah was less-than-friendly in terms of building on Windows (which is
> why we actually had _namemapper.pyd files checked in.)

<shrug>  The 2.2.1 .pyd seems to work fine with 2.0.1 (I already tested
that before you responded because I was in a hurry); if we run into
problems, we'll probably just upgrade Cheetah.

(Just to be explicit, installing the .pyd did fix the performance
problems.)

>> Any clue why Cheetah is so fast outside the .EXE without any
>> _namemapper.pyd around?
> 
> The very nature of the NameMapper's function means it's going to call a
> lot of functions and iterate quite a bit through a few lists, IIRC the
> C version just cuts down a lot of overhead related to Python dynamic
> lookup and dispatch. I'm probably wrong about that though :)

Yeah, I know, I just can't figure out how it could possibly work so fast
using the .py outside the .EXE.  It's not worth chasing down, though.
(I did verify by doing a manual import that there isn't any
_namemapper.pyd around)

> p.s. mind me asking what you're shipping with Cheetah on Windows? :D

http://www.egnyte.com/ has a "local cloud client" that uses Cheetah on
CherryPy to run the UI.
-- 
Aahz ([email protected])           <*>         http://www.pythoncraft.com/

"I won't accept a model of the universe in which free will, omniscient
gods, and atheism are simultaneously true."  --M

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf