Hi all,

Ticket #14297 [1] suggests changes to LazySettings for performance
improvements.  The best solution AFAIC is that __getattr__ triggers a
setup routine on first access, which loads *all* the settings into the
LazySetting object itself.  This eliminates the __getattr__ overhead for
all subsequent retrieval of settings (apart from when the setting
doesn't exist, in which case you still get a __getattr__ call).

This should be a fully backwards compatible change.  There were some
test failures, but these were all caused by test code relying on the
internal implementation of LazySettings, i.e. the '_wrapped' object
attribute (when in fact there was no need to do this after r11824 [2]) 

But can anyone else think of any gotchas with this change before I
commit it? It produces a 30% improvement for the benchmark that relates
to the ticket [3].

Thanks,

Luke


[1] http://code.djangoproject.com/ticket/14297
[2] http://code.djangoproject.com/changeset/11824
[3]
http://github.com/spookylukey/djangobench/tree/master/djangobench/benchmarks/l10n_render/

-- 
"Christ Jesus came in to the world to save sinners" (1 Timothy 1:15)

Luke Plant || http://lukeplant.me.uk/


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to