#35236: Access Field.attname and Field.column directly
-------------------------------------+-------------------------------------
               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          |
-------------------------------------+-------------------------------------
 Many field references call `Field.get_attname_column()` or
 `Field.get_attname()`, despite the `attname` and `column` attributes
 containing the computed results (after `contribute_to_class()`). Updating
 those call sites to plain attribute access eliminates some function calls,
 a worthy small speedup.

 From a profile of system checks on a smaller project, there were ~1k calls
 for various versions of each method:

 {{{
 630    0.000    0.000    0.000    0.000
 __init__.py:976(get_attname_column)
 208    0.000    0.000    0.000    0.000
 related.py:1122(get_attname_column)
 431    0.000    0.000    0.000    0.000 related.py:1119(get_attname)
 666    0.000    0.000    0.000    0.000 __init__.py:973(get_attname)
 }}}

 All of these are eliminated by moving to attribute access.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35236>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018dc37f7ad8-a7c75573-421d-427b-a918-37250dc1dbc6-000000%40eu-central-1.amazonses.com.

Reply via email to