#17025: sql/where.py WhereNode refactoring -------------------------------------+------------------------------------- Reporter: akaariai | Owner: nobody Type: | Status: new Cleanup/optimization | Version: 1.3 Component: Database layer | Resolution: (models, ORM) | Triage Stage: Severity: Normal | Unreviewed Keywords: orm cleanup | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 0 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by akaariai): I tried that attnames approach. Unfortunately I didn't see any difference. When I tried with `__dict__`[attname] = val, I got around 20% speedup. I think it is the setattr calls that are the problem, and they can not be made faster easily. If I remove signals and manually do self.field1 = args[1], self.field2 = args[2] and so on, I will get the init down to 0.5 seconds, or 50% faster for the 1000 objects from the DB test. Using raw SQL for the same query takes 0.2 seconds, so there is still some overhead, but not nearly as much. I would imagine 0.5 seconds speed would be possible for a C code / generated code `__init__`. Should be a fun little project to do that (of course as an external project). Re signal sending: #16679 This is an interesting topic, but it is out of scope for this ticket. -- Ticket URL: <https://code.djangoproject.com/ticket/17025#comment:7> 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.