#35230: Cache ForeignObjectRel.get_accessor_name()
-------------------------------------+-------------------------------------
               Reporter:  Adam       |          Owner:  nobody
  Johnson                            |
                   Type:             |         Status:  assigned
  Cleanup/optimization               |
              Component:  Database   |        Version:  dev
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 This method computes the name for the accessor descriptor, used in many
 places. Its results are stable, unless the optional `model` parameter is
 provided, used only in forms.

 Adding a cached property `accessor_name` for the default value can speed
 up many code paths. In particular, I profiled the system checks for a
 project and found it was taking ~2% of the runtime, which can be basically
 eliminated with caching. Results:

 Before: 6625 calls taking 2ms
 After: 9 calls taking ~0ms
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35230>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018dbc2ee7d7-dfa7255c-444a-4579-a494-7aa8e968a392-000000%40eu-central-1.amazonses.com.

Reply via email to