#16679: Speed up signals by caching the reveicers per sender
-------------------------------------+-------------------------------------
     Reporter:  akaariai             |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |                  Version:  1.3
    Component:  Database layer       |               Resolution:
  (models, ORM)                      |             Triage Stage:  Ready for
     Severity:  Normal               |  checkin
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin


Comment:

 A rebased and slightly simplified version at
 https://github.com/akaariai/django/tree/ticket_16679.

 Benchmarks:
 model_init_signals (pre and post init signals defined for model __other__
 than initialized, one field for the initialized model):
 {{{
 Running 'model_init_signals' benchmark ...
 Min: 0.012126 -> 0.007745: 1.5656x faster
 Avg: 0.012178 -> 0.007774: 1.5666x faster
 Significant (t=644.833741)
 Stddev: 0.00004 -> 0.00002: 2.3318x smaller (N = 34)
 }}}
 Benchmark available at:
 
https://github.com/akaariai/djangobench/tree/continuous_bechmarking/djangobench/benchmarks/model_init_signals
 (Note that the djangobench used is somewhat hacked version - it discards
 2/3 of the results - the highest third and the lowest third - to get
 consistent results on my laptop).

 model_init_self_signals (pre and post init for same model):
 {{{
 Running 'model_init_self_signals' benchmark ...
 Min: 0.014637 -> 0.011735: 1.2473x faster
 Avg: 0.014675 -> 0.011762: 1.2477x faster
 Significant (t=530.411861)
 Stddev: 0.00002 -> 0.00002: 1.2429x smaller (N = 34)
 }}}
 
https://github.com/akaariai/djangobench/tree/continuous_bechmarking/djangobench/benchmarks/model_init_self_signals

 query_all (no signals at all, 1000 objects from DB)
 {{{
 Running 'query_all' benchmark ...
 Min: 0.006779 -> 0.006783: 1.0006x slower
 Avg: 0.006819 -> 0.006825: 1.0010x slower
 Not significant
 Stddev: 0.00003 -> 0.00003: 1.1693x larger (N = 34)
 }}}
 
https://github.com/akaariai/djangobench/tree/continuous_bechmarking/djangobench/benchmarks/query_all

 All tests pass and I don't see any reason to not add the cache. So, will
 commit tonight if no objections.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16679#comment:16>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to