Re: pre_init/post_init vs. performance

2012-07-28 Thread Anssi Kääriäinen
On 27 heinä, 18:58, Jeremy Dunck wrote: > Can I get a review of the branch?  25% performance improvement of > Model.__init__ in stock django seems worth landing. :) I did some work to add new benchmarks to djangobench. In my tests the speedup for the init hooks approach was nearly 60% when both p

Re: pre_init/post_init vs. performance

2012-07-27 Thread Jeremy Dunck
Can I get a review of the branch? 25% performance improvement of Model.__init__ in stock django seems worth landing. :) On Wed, Jul 18, 2012 at 3:48 AM, Jeremy Dunck wrote: > On Sun, Jul 15, 2012 at 11:07 AM, Jeremy Dunck wrote: >> >> That is indeed what I meant, but I think Anssi's probably r

Re: pre_init/post_init vs. performance

2012-07-18 Thread Jeremy Dunck
On Sun, Jul 15, 2012 at 11:07 AM, Jeremy Dunck wrote: > > That is indeed what I meant, but I think Anssi's probably right that > this belongs in contribute_to_class instead of a new adhoc thing in > ModelBase.__new__. > > I'll take a swing at making this change. > > Opened related ticket: https://

Re: pre_init/post_init vs. performance

2012-07-15 Thread Jeremy Dunck
On Sun, Jul 15, 2012 at 9:51 AM, Andy McCurdy wrote: > > On Jul 14, 2012, at 6:37 PM, Russell Keith-Magee wrote: > >> >> My only concern is: >> >>> We could store which fields have these hooks upon ModelBase.__new__ >>> construction and so skip most fields and overhead in __init__. >> >> I'm not s

Re: pre_init/post_init vs. performance

2012-07-15 Thread Andy McCurdy
On Jul 14, 2012, at 6:37 PM, Russell Keith-Magee wrote: > > My only concern is: > >> We could store which fields have these hooks upon ModelBase.__new__ >> construction and so skip most fields and overhead in __init__. > > I'm not sure if I'm misreading your intentions here, but just to be > s

Re: pre_init/post_init vs. performance

2012-07-14 Thread Russell Keith-Magee
On Sat, Jul 14, 2012 at 10:57 AM, Jeremy Dunck wrote: > I was poking around in our (Votizen's) use of signals and thinking > about making some tooling so that signal usage was a bit more > transparent. > > In doing so, I noticed that GenericForeignKey hooks the model pre_init > signal. It does th

Re: pre_init/post_init vs. performance

2012-07-14 Thread Anssi Kääriäinen
On 14 heinä, 05:57, Jeremy Dunck wrote: > I was poking around in our (Votizen's) use of signals and thinking > about making some tooling so that signal usage was a bit more > transparent. > > In doing so, I noticed that GenericForeignKey hooks the model pre_init > signal.  It does that because GFK

pre_init/post_init vs. performance

2012-07-13 Thread Jeremy Dunck
I was poking around in our (Votizen's) use of signals and thinking about making some tooling so that signal usage was a bit more transparent. In doing so, I noticed that GenericForeignKey hooks the model pre_init signal. It does that because GFK needs a chance to munge kwargs from the GFK field n