I would suggest rewriting the loop in your template as a templatetag. Something like this
@register.simple_tag def render_locations(locations): html = u""" html %(x)s stuff %(y)s here %(link)s """ return '\n'.join([html % { 'x': loc.x, 'y': loc.y', 'link': loc.link } for loc in locations]) I've used this approach a few times with good results for my use cases. Regards Knut On Tue, Nov 2, 2010 at 9:28 PM, Lars Ruoff <lars.ru...@gmail.com> wrote: > Ok, thanks for the suggestion, Javier. > I implemented this and it showed: > I'm spending about > 0.2 secs for the queries, > but 1.5 secs for t.render(c) ! > > So rendering the template seems to take a significant amount of time! > As you can see, my template code iterates over about 13*13=169 objects > that have been passed in the context. > I then made tests to reduce this number. Here is the result of time > spent for the query and render() as a function of the grid size: > 3*3: 0.03s, 0.1s > 5*5: 0.04s, 0.25s > 7*7: 0.08s, 0.45s > 9*9: 0.13s, 0.72s > 11*11: 0.17s, 1.1s > 13*13: 0.2s, 1.5s > > Lars > > > On Nov 2, 4:46 pm, Javier Guerra Giraldez <jav...@guerrag.com> wrote: >> On Tue, Nov 2, 2010 at 3:35 AM, Lars Ruoff <lars.ru...@gmail.com> wrote: >> > Ok, so having excluded SQLite and the static served files, I'd like to >> > test if the server matters. What would be a minimum Apache install and >> > config to run Django locally (on Windows)? >> >> again, that's _very_ unlikely to be the cause. why not profile a >> little? if you're not handy with a python profiler, just set a var >> 'starttime = datetime.now()' at the beginning of your view function >> and a few 'print(datetime.now() - starttime)' at strategic points. >> >> -- >> Javier > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.