Re: Importing Cheetah.Template.Template unusually slow?

Aahz <[email protected]> Wed, 27 Jan 2010 10:02:05 -0800
Newsgroups gmane.comp.python.cheetah
Organization The Cat & Dragon
Message-ID <[email protected]>
On Wed, Jan 27, 2010, Matthew Beauregard wrote:
> 
> I was trying to speed up my CGI, and I worked out that the lion's
> share of execution time was taken up by the Cheetah import.  Is 0.7s
> unusually slow?  Where should I start in trying to speed it up?
>
> time python -c 'from Cheetah.Template import Template'
>
> real 0m0.693s

Looks like you're right about the slowness of importing Cheetah.Template,
and I'm guessing that it has to do with the fact that "import Cheetah"
doesn't really do much, but Cheetah.Template imports the rest of the
Cheetah universe.  Take a look at Template.py, and note that Template.py
and Parser.py are the two biggest modules right up front, and Parser.py
does lots of work on import.

I would suggest you try to get off CGI as your best course of action and
use some persistent framework instead.
-- 
Aahz ([email protected])           <*>         http://www.pythoncraft.com/

import antigravity

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com