Re: 2D map application: performance and design question

2010-11-04 Thread Lars Ruoff
Excellent advice! With this I'm down to less than 0.02 secs for the 13x13 map rendering! Regards, Lars On Nov 2, 9:45 pm, Knut Ivar Nesheim wrote: > I would suggest rewriting the loop in your template as a templatetag. > Something like this > > @register.simple_tag > def render_locations(locati

Re: 2D map application: performance and design question

2010-11-02 Thread Knut Ivar Nesheim
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])

Re: 2D map application: performance and design question

2010-11-02 Thread Lars Ruoff
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 hav

Re: 2D map application: performance and design question

2010-11-02 Thread Javier Guerra Giraldez
On Tue, Nov 2, 2010 at 3:35 AM, Lars Ruoff 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

Re: 2D map application: performance and design question

2010-11-02 Thread Kenneth Gonsalves
On Tue, 2010-11-02 at 01:35 -0700, Lars Ruoff 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)? try nginx+fcgi/tornado/your favourite webserver -- r

Re: 2D map application: performance and design question

2010-11-02 Thread Lars Ruoff
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)? On Nov 1, 7:30 pm, Lars Ruoff wrote: > Ok, thanks all, > > So following Bill's advice, i did:>python manage.py

Re: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Ok, thanks all, So following Bill's advice, i did: >python manage.py shell >>> import game.models >>> list(game.models.Location.objects.filter( \ ... x__gte=34, \ ... x__lte=46, \ ... y__gte=24, \ ... y__lte=36)) ...and the result showed up instantly! So it seems DB is not the issue. Will

Re: 2D map application: performance and design question

2010-11-01 Thread Bill Freeman
My experience with Django debug toolbar is that it makes things slow all by itself. I have done a couple of apps that use the equivalent query, using PostgreSQL, without noticing a performance issue, with everything running on a Linux server. 1. Have you tried timing the query by hand? That is,

Re: 2D map application: performance and design question

2010-11-01 Thread Javier Guerra Giraldez
On Mon, Nov 1, 2010 at 5:55 AM, Cal Leeming [Simplicity Media Ltd] wrote: > 9 out of 10 times, the bottleneck is usually the database true, but 8.7 of those 9 are about how the database is used, and not about the engine choice. simply changing SQLite won't improve significantly the one-user case

Re: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Hi Lukasz, see my answer to Daniel. Replacing images by text didn't speed up things much. Is there any other test/profiling that i should do? Would taking the systime before and after the query give me some hints? I'll try this later... On Nov 1, 12:39 pm, Łukasz Rekucki wrote: > On 1 November 20

Re: 2D map application: performance and design question

2010-11-01 Thread Łukasz Rekucki
On 1 November 2010 10:59, Lars Ruoff wrote: > Hello, > > first of all, these are my first steps with Django, and i only have > limited experience with Python, so please be patient. > > I'm using it for what is intended to be a browser game in the future. > The main part of the game is a zoom view

Re: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Hi Daniel, you are right that images are being loaded. But i gave it a try and replaced the images by text. Still the page takes about 3 seconds to load. Lars On Nov 1, 12:30 pm, Daniel Roseman wrote: > It's a bit hard to tell without knowing how the slowness appears. What > exactly is slow? >

Re: 2D map application: performance and design question

2010-11-01 Thread Lars Ruoff
Ok, but that said, the database isn't that big here. (Well, i guess) There are currently 4800 entries in the "Location" table. Is this too much for SQLite already? May it be the query in locations = Location.objects.filter( \ x__gte=center_location.x-half_x, \ x__lte=center_loc

Re: 2D map application: performance and design question

2010-11-01 Thread Daniel Roseman
On Nov 1, 9:59 am, Lars Ruoff wrote: > Hello, > > first of all, these are my first steps with Django, and i only have > limited experience with Python, so please be patient. > > I'm using it for what is intended to be a browser game in the future. > The main part of the game is a zoom view on a tw

Re: 2D map application: performance and design question

2010-11-01 Thread Cal Leeming [Simplicity Media Ltd]
Hi Lars, Unless you are doing some *really* intense Python code in your business logic, then 9 out of 10 times, the bottleneck is usually the database, especially if you are using Python. Cal On Mon, Nov 1, 2010 at 9:59 AM, Lars Ruoff wrote: > Hello, > > first of all, these are my first steps