Hi Rich,

On 26 févr. 2016, at 16:36, Rich Jones <miser...@gmail.com> wrote:

> I'd love to discuss ideas for performance optimizations to Django's setup 
> method. 


In my opinion, the first concrete step would be to measure how much time is 
spent executing Django code rather than importing Python modules. That’s tricky 
because the two are intertwined: django.setup() mostly imports all the modules 
required by the project. If 90% of the time is spent importing modules and 10% 
doing other things, then there’s not much to gain by optimizing these other 
things!

While performance improvements are always good, I’m against changes that would 
re-introduce non-determism in the app-loading process.

Django 1.7 eliminated a whole class of bugs, included some that randomly 
occurred with low probability when restarting a production server under load. 
These bugs aren’t fun to track down.

The global import lock was replaced by per-module locks in Python 3.3. This 
implies you could import things in threads on Python 3.3+ and it may be faster. 
However I’m afraid any thread-based solution will re-introduce non-determism.

I remember trying to simplify:

- building Options classes (aka. Model._meta)
- building relations between models

and failing multiple times, due to the difficulty of preserving 
backwards-compatibility. I think it’s doable but it will take someone smarter, 
more persistent and/or more familiar with the app-loading process than I am. 
And I’m not even sure it would have an effect on performance!

Best regards,

-- 
Aymeric.


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/10BD8633-CF0F-48BE-A655-DB418EEEC418%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to