logo       

Import speed issue: msg#00052

python.cheetah

Subject: Import speed issue

Hello,

When importing Cheetah's template functionality, via:
from Cheetah import Template
there seems to be quite a noticable lag for that import to execute.
It adds considerable wait time to loading my Web applications with Python and
Cheetah. "import Cheetah" is quick, "from Cheetah import *" is quick, but I
cannot access the Template object.

I have all .pyc and .pyo files that are up to date and I'm using the latest
version of Cheetah and Python. I am stumped as to what's taking the time to
load the module's contents, particularly, the importing of the Template class
as that's all I need.

The time to import seems to be a major factor of the "feel"/response by users
that load the pages generated from my Python applications. I have a few sample
baseline times that can show what I'm working with:

$ time python -c 'from sys import exit'
python -c 'from sys import exit' 0.05s user 0.03s system 102% cpu 0.076 total
$ time python -c 'import Cheetah'
python -c 'import Cheetah' 0.06s user 0.01s system 86% cpu 0.081 total
$ time python -c 'from Cheetah import Template'
python -c 'from Cheetah import Template' 0.58s user 0.05s system 97% cpu 0.647
total

I understand Cheetah provides a lot of functionality and the execution time
on a more complex application is negligible but shaving any time would be nice.

If anybody could shed some light on speeding this up, I would appreciate it.


Thank you,

Brian


-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise