Re: Importing Cheetah.Template.Template unusually slow?

"R. Tyler Ballance" <[email protected]> Wed, 27 Jan 2010 10:02:06 -0800
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
On Wed, 27 Jan 2010, Matthew Beauregard wrote:

> Hi,
> 
> 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?

What version are Cheetah are you running? I'm also curious if your machine
isn't generating a Template.pyc for Template.py, causing the interpreter to
generate new byte-code for every request.

It's also worth mentioning that in a CGI environment you are going to have some
bit of slow-down with imports to begin with, you can mitigate this by making
sure that a new instance of the interpreter isn't started for each requests,
allowing a single instance service thousands of requests (mod_python has some
options for this IIRC)


> 
> thanks,
> Matthew
> 
> 
> 
> time python -c 'from Cheetah.Template import Template'
> 
> real    0m0.693s
> user    0m0.581s
> sys     0m0.104s
> 
> 
> OSX 10.6.2
> 
> Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) 
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> 
> 
> 
> ------------------------------------------------------------------------------
> 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
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
Cheers,
-R. Tyler Ballance
--------------------------------------
 Jabber: [email protected]
 GitHub: http://github.com/rtyler
Twitter: http://twitter.com/agentdero
   Blog: http://unethicalblogger.com

------------------------------------------------------------------------------
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

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)

iEYEARECAAYFAktgf50ACgkQFCbH3D9R4W/k1gCfWVHDF6j0rdQW9byKCpFdQlUG
YSUAn2Ic57DwCtfBMRbvWo96eR0YNbjO
=x3HS
-----END PGP SIGNATURE-----