On Wed, 2011-12-07 at 05:48 -0800, Derek wrote:
> > I make similar names - although frankly I do not know where I got
> the
> > impression from and whether it is correct or not.
>
> Yes, I would agree with that. So code like:
>
> scrs = Score.objects.all()
>
> could then be written as:
>
> sco
On Dec 6, 12:34 pm, kenneth gonsalves wrote:
> On Tue, 2011-12-06 at 02:15 -0800, Derek wrote:
> > Another side comment would be a suggestion to avoid "old skl vrbl nms"
> > - in other words, use "player" for "ply", "month" for "mnth", "scores"
> > for "scrs", "form" for "fm" and so on. It may se
2011/12/6 kenneth gonsalves
>
> I first did select_related() and the laptop nearly caught fire! timed
> out after an hour or so. I then did select_related(depth=1) and it took
> less than a minute.
>
Indeed, select_related() will follow every foreignkey it gets to, which can
be a lot, so you eit
On Mon, 2011-12-05 at 11:18 +0100, Håkon Erichsen wrote:
> One thing you should look into is
> QuerySet.select_related():
> https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-related
>
> Without it, every time you run scr.hole on a new scr, Django will run
> a new query, fetching
On Tue, 2011-12-06 at 02:15 -0800, Derek wrote:
> Another side comment would be a suggestion to avoid "old skl vrbl nms"
> - in other words, use "player" for "ply", "month" for "mnth", "scores"
> for "scrs", "form" for "fm" and so on. It may seem obvious right now
> what those mean, but you (or so
On Dec 5, 12:18 pm, Håkon Erichsen wrote:
> 2011/12/5 kenneth gonsalves
>
>
> That seems to be the biggest problem you have. Some other comments:
>
> - Holy mother of god, that's a huge view file! I would advice to slice
> it into logically separated files, and put this in a directory called
> "v
2011/12/5 Brian Schott
> What's the best dangothonic way to break up models.py or views.py for that
> matter.
> 1. Create a models.py or views.py at the top level that does a bunch of
> imports? Explicitly or progrmmatically by looping over files?
> 2. Expose the hierarchy to the caller. Ex: fr
With select related, hole queries can be ommitted but this time for
every score object one hole object will be created. so there will be
alot of hole objects.
On Dec 5, 12:18 pm, Håkon Erichsen wrote:
> 2011/12/5 kenneth gonsalves
>
> > The code looks simple to me, but to analyse 10,000 rounds
First of all You are queryin everything that you have on database for
this view and making django model objects from those. For a large db
this will run very slow and for larger dbs, it will throw memmory
exception.
Try something like this:
for hole in Hole.objects.filter(tee_course=club):
...
That's usually a bad sign when other programmers start naming saints when
reviewing your code :-). I have similar code explosion issues in a models.py
file in a site I'm building.
What's the best dangothonic way to break up models.py or views.py for that
matter.
1. Create a models.py or v
2011/12/5 kenneth gonsalves
> The code looks simple to me, but to analyse 10,000 rounds of golf
> (1,80,000 hole scores) my 2 GB laptop takes 20 minutes. Would this be
> considered normal - or slow? If slow, ideas on how to speed it up would be
> appreciated.
>
>
One thing you should look into i
On Mon, 2011-12-05 at 11:36 +0100, Masklinn wrote:
> >
> https://bitbucket.org/lawgon/djangogolf/src/a86c388f1795/web/views.py#cl-372
> analyses golf scores and calculates the relative difficulty of the holes. The
> code looks simple to me, but to analyse 10,000 rounds of golf (1,80,000 hole
>
On 2011-12-05, at 10:56 , kenneth gonsalves wrote:
> I have a function called holediff - the code is here:
>
> https://bitbucket.org/lawgon/djangogolf/src/a86c388f1795/web/views.py#cl-372
> analyses golf scores and calculates the relative difficulty of the holes. The
> code looks simple to me,
I have a function called holediff - the code is here:
https://bitbucket.org/lawgon/djangogolf/src/a86c388f1795/web/views.py#cl-372
analyses golf scores and calculates the relative difficulty of the holes. The
code looks simple to me, but to analyse 10,000 rounds of golf (1,80,000 hole
scores)
14 matches
Mail list logo