On Mar 28, 6:26 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2007-03-28 at 19:59 +0000, Milan Andric wrote:
> > Hellow,
>
> > Any advice you can offer on optimizing this view would be greatly
> > appreciated.
>
> >http://dpaste.com/7543/
>
> > I was planning on trying to reduce the amount of data in pForms, the
> > list that is passed to the template.  Since i'm saving 19
> > presentations into this list along with the forms, i'm assuming this
> > is the bottleneck.  Any ideas how to work around this?
>
> Don't assume... test! You can put calls to time.time() in various places
> in the view and then print out the differences between them to a file or
> to stderr (or even stdout if you are using the development server). That
> will show you which portions are taking the longest. With a few
> iterations, moving the time.time() calls around, you should be able to
> work out the exact lines that are taking the most time.
>
> Then come back and we can talk.
>
> You might discover, for example, that it's not the view that is taking
> all the time, but the template rendering for some reason (such as making
> a lot of database calls by constructing querysets whilst rendering the
> template).
>

Hi Malcolm,

Thanks for your response.  I'm failing at getting any debug
information out of the production (apache2/mod_python) environment.  I
tried using print and  sys.stderr.write but the logs show no signs of
it.  So there might be something broken there.  Will get to that
later.

But in the dev environment I can see pretty well that the view is
functioning very quickly.  So your hunch about the problem lying in
the templates is probably right.

So I posted the template: http://dpaste.com/7603/ .
I'm not sure how to optimize the querysets.  Don't make the queries in
the template?   What are some ways to optimize this template.  In the
meantime I'll try to scan the ML archives and looking at caching.

Let me know what you think.

The problem with caching is that this view is unique for each user.
That's how it is now at least, but maybe I need to take a new
approach.  My current one takes little thought.  Pre-optimization is
the root of all evil. ;)

Milan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to