#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:  Accepted
     Severity:  Normal               |      Needs documentation:  0
     Keywords:                       |  Patch needs improvement:  1
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by akaariai):

 * needs_better_patch:  0 => 1


Comment:

 Actually now that I think about it, dynamic creation of subclasses will
 not be a problem for the caching approach. The memory used by the signals
 cache will be much less than the memory used by the app module cache
 anyways. For the caching approach the only real killer is dynamic addition
 / removal of signals. But I think that could be improved somewhat easily.

 And I claim that inherited signals would be useful. An external
 application like Haystack could use them, see this for example:
 [https://github.com/toastdriven/django-
 haystack/blob/master/haystack/indexes.py#L289]. Now, if you save a
 inherited model, it is not going to do any indexing. They would surely
 want inherit=True. However if a decision needs to be made between fast
 `__init__` signals and inherited signals, it is the model initialization
 that is important.

 But lets concentrate here on making the signals as fast as possible and
 nothing else. Even if it is decided that we want inherited signals and
 thus caching, it would still be a good idea to have proper data structures
 for signal storage.

 The patch seems to fail signals / signals_regress test suites. Some high
 level comments about what is going on with the datastructures would be
 useful.

 I assume the worst case for your patch, where you have a connected
 receiver for both sender=None and sender=`CurrentSender` isn't a common
 case?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16679#comment:9>
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to