Re: [Django] #35236: Access Field.attname and Field.column directly

2024-02-20 Thread Django
#35236: Access Field.attname and Field.column directly
-+-
 Reporter:  Adam Johnson |Owner:  Adam
 Type:   |  Johnson
  Cleanup/optimization   |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

 * resolution:   => fixed
 * status:  assigned => closed

Comment:

 In [changeset:"31314980be428c0ab8a6cf40cce0a0c17ead8ec6" 31314980]:
 {{{#!CommitTicketReference repository=""
 revision="31314980be428c0ab8a6cf40cce0a0c17ead8ec6"
 Fixed #35236 -- Used Field.attname/column attributes instead of
 get_attname()/get_attname_column().
 }}}
-- 
Ticket URL: 
Django 
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/0107018dc66d3fcf-07c6bdc5-b722-4557-b5b9-b3a6408cee86-00%40eu-central-1.amazonses.com.


Re: [Django] #35236: Access Field.attname and Field.column directly

2024-02-20 Thread Django
#35236: Access Field.attname and Field.column directly
-+-
 Reporter:  Adam Johnson |Owner:  Adam
 Type:   |  Johnson
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin

-- 
Ticket URL: 
Django 
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/0107018dc6171fbe-d035a3bd-f674-4948-b3b0-0a3bf0017319-00%40eu-central-1.amazonses.com.


Re: [Django] #35236: Access Field.attname and Field.column directly

2024-02-19 Thread Django
#35236: Access Field.attname and Field.column directly
-+-
 Reporter:  Adam Johnson |Owner:  Adam
 Type:   |  Johnson
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Unreviewed => Accepted

Comment:

 I'm always preoccupied with such cleanups as more often than not they
 cause regressions, but agreed, let's give it a chance.
-- 
Ticket URL: 
Django 
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/0107018dc5692e28-57ec9ce7-ec3c-4b05-9beb-7185be1cd0c2-00%40eu-central-1.amazonses.com.


Re: [Django] #35236: Access Field.attname and Field.column directly

2024-02-19 Thread Django
#35236: Access Field.attname and Field.column directly
-+-
 Reporter:  Adam Johnson |Owner:  Adam
 Type:   |  Johnson
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Adam Johnson):

 I think it has very little chance to break things. There are hundreds of
 pre-existing uses of `.attname` and `.column`, the PR only updates a
 handful. Also, non-deterministic `attname` would be somewhat meaningless,
 as nothing would reattach the field’s descriptor with a different
 attribute name.
-- 
Ticket URL: 
Django 
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/0107018dc5443fe2-f2abcc5a-e201-41f5-bfbc-8efff7f6b5f1-00%40eu-central-1.amazonses.com.


Re: [Django] #35236: Access Field.attname and Field.column directly

2024-02-19 Thread Django
#35236: Access Field.attname and Field.column directly
-+-
 Reporter:  Adam Johnson |Owner:  Adam
 Type:   |  Johnson
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Mariusz Felisiak):

 I'm pretty sure this will break some 3rd party packages,
 e.g.[https://github.com/martsberger/django-
 
joinfield/blob/c73bb4cfb7827126ac57c5bdf6b6a3b7e10dd54e/joinfield/joinfield.py#L60-L61
 django-joinfield]. I don't think it's worth doing.
-- 
Ticket URL: 
Django 
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/0107018dc4f4b7bc-79033243-90e1-435f-959f-37536ddbc6ef-00%40eu-central-1.amazonses.com.


Re: [Django] #35236: Access Field.attname and Field.column directly

2024-02-19 Thread Django
#35236: Access Field.attname and Field.column directly
-+-
 Reporter:  Adam Johnson |Owner:  Adam
 Type:   |  Johnson
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Adam Johnson):

 * has_patch:  0 => 1
 * owner:  nobody => Adam Johnson


Old description:

> 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:
>
> {{{
> 6300.0000.0000.0000.000
> __init__.py:976(get_attname_column)
> 2080.0000.0000.0000.000
> related.py:1122(get_attname_column)
> 4310.0000.0000.0000.000 related.py:1119(get_attname)
> 6660.0000.0000.0000.000 __init__.py:973(get_attname)
> }}}
>
> All of these are eliminated by moving to attribute access.

New description:

 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 ~2k calls
 between the versions of each method:

 * 630 for `Field.get_attname_column()`
 * 208 for `ForeignKey.get_attname_column()`
 * 666 for `Field.get_attname()`
 * 431 for `ForeignKey.get_attname()`

 All of these are eliminated by moving to attribute access.

--
-- 
Ticket URL: 
Django 
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/0107018dc39ac08c-bdfddc41-3755-488a-abb1-5501f329c75c-00%40eu-central-1.amazonses.com.