#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: 0 Has patch: 1 | UI/UX: 0 Needs tests: 0 | Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by akaariai): I quickly tried your patch, but didn't see performance improvement in this case: {{{ class A(models.Model): pass class B(models.Model): pass def recv1(*args, **kwargs): pass signals.pre_init.connect(recv1, sender=B, weak=False) signals.post_init.connect(recv1, sender=B, weak=False) for i in range(0, 1000): A(i) }}} Note that the connected signals for B are slowing down A `__init__`. This is the case where the cached signals (fast-signals2.diff) give the best performance increase. -- Ticket URL: <https://code.djangoproject.com/ticket/16679#comment:4> 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 this group at http://groups.google.com/group/django-updates?hl=en.