Opened 7 weeks ago
Closed 3 weeks ago
#36927 closed Cleanup/optimization (fixed)
Optimize Field.deconstruct()
| Reported by: | Adam Johnson | Owned by: | Adam Johnson |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I profiled a subset of Django’s test suite (runtests.py --parallel 1 model* queries expressions*) with cProfile and found that Field.deconstruct() was the function in Django with the largest time consumed inside itself (0.123s of 7.843 total, or 1.6%).
It can be optimized by flattening its main loop for constructing keyword arguments and by performing fewer string comparisons for the path.
Change History (4)
comment:1 by , 6 weeks ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 4 weeks ago
| Has patch: | set |
|---|
comment:3 by , 4 weeks ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Note:
See TracTickets
for help on using tickets.
Thanks for the ticket!