> {% ifequal newsitem.user.id 12 %}

Just a guess, but is it possible that this requires a separate query for the
user for each item in object_list?

Michael

> -----Original Message-----
> From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of [EMAIL PROTECTED]
> Sent: Saturday, September 22, 2007 2:25 PM
> To: Django users
> Subject: template speed
> 
> 
> Hello.
> 
> I'm worrying about my django-app setted up on mod_python 3.3.1+apache
> 2.0.59 speed.
> I have this model http://dpaste.com/20362/. On production server
> (Pentium D, 2Gb RAM) with all DEBUG turned off and StatsMiddleware
> from (http://code.djangoproject.com/wiki/PageStatsMiddleware to get
> page generation time) i've tested two different templates (both
> rendered by object_list generic view):
> 
> First:
> {%for object in object_list%}
> {{object}}
> {%endfor%}
> 
> Gives about 0.013 - 0.023sec page generation time
> 
> Second more complicated (most of HTML code removed to improve
> reading):
> 
> {% for newsitem in object_list %}
> 
> <a href="{{ newsitem.get_absolute_url }}" class="news-item-
> title">{{ newsitem.title }}</a>
> {{ newsitem.pdate|date:"j.m.Y" }}
> 
> {% ifequal newsitem.user.id 12 %}
> <a class="news-item-author" href="mailto:
> {{ newsitem.email }}">{{ newsitem.author }}</a> |
> {% else %}
> <a class="news-item-author" href="mailto:
> {{ newsitem.user.email }}">{{ newsitem.user.username }}</a> |
> {% endifequal %}
> 
> <div class="level">
> <p class="news-item-text">{{ newsitem.brief|striptags }}</p>
> </div>
> </div>
> {% endfor %}
> 
> This gives ten times more: 0.1-0.14 secs, in both cases SQL time was
> like 0.006-0.008 secs.
> Is it normal, that this very simple code take ten times more
> processing? You see that i don't make any manytomany relationship
> lookups neither some heavy func calls.
> 
> Plus to this, ab testing (ab -n100 -c 15) gives about 5 req/sec  which
> is pretty slow, i think.
> 
> 
> Regards, Dmitry.
> 
> 
> 

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