Opened 3 weeks ago

Last modified 4 days ago

#36927 assigned Cleanup/optimization

Optimize Field.deconstruct()

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
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 (2)

comment:1 by Clifford Gama, 3 weeks ago

Triage Stage: UnreviewedAccepted

Thanks for the ticket!

comment:2 by Adam Johnson, 4 days ago

Has patch: set
Note: See TracTickets for help on using tickets.
Back to Top