Re: [Django] #35407: Cache Model._meta.swapped

2024-05-07 Thread Django
#35407: Cache Model._meta.swapped
-+-
 Reporter:  Adam Johnson |Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |
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 Sarah Boyce <42296566+sarahboyce@…>):

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

Comment:

 In [changeset:"7abe5112f4cb50c15b79a2afd4c1b68f0767b243" 7abe511]:
 {{{#!CommitTicketReference repository=""
 revision="7abe5112f4cb50c15b79a2afd4c1b68f0767b243"
 Fixed #35407 -- Cached model's Options.swapped.
 }}}
-- 
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/0107018f5304ab33-350569fb-acde-4f04-806e-42e44eb48339-00%40eu-central-1.amazonses.com.


Re: [Django] #35407: Cache Model._meta.swapped

2024-05-07 Thread Django
#35407: Cache Model._meta.swapped
-+-
 Reporter:  Adam Johnson |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
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 Sarah Boyce):

 * 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/0107018f52405760-bb7e9cf3-4e09-414a-9792-40cf4b90e809-00%40eu-central-1.amazonses.com.


Re: [Django] #35407: Cache Model._meta.swapped

2024-05-03 Thread Django
#35407: Cache Model._meta.swapped
-+-
 Reporter:  Adam Johnson |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
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 Adam Johnson):

 * needs_tests:  1 => 0

-- 
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/0107018f3f2c890f-8dcd0d75-80dd-4240-b4ec-24d2a9c0f9d6-00%40eu-central-1.amazonses.com.


Re: [Django] #35407: Cache Model._meta.swapped

2024-04-26 Thread Django
#35407: Cache Model._meta.swapped
-+-
 Reporter:  Adam Johnson |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Natalia Bidart):

 * needs_tests:  0 => 1

-- 
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/0107018f1a4d0def-33ba6ca9-7dfb-46e4-ad79-2a24325872b7-00%40eu-central-1.amazonses.com.


Re: [Django] #35407: Cache Model._meta.swapped

2024-04-26 Thread Django
#35407: Cache Model._meta.swapped
-+-
 Reporter:  Adam Johnson |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
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 Natalia Bidart):

 * stage:  Unreviewed => Accepted

Comment:

 Thank you Adam! I a little on the fence on this one but let's give it a
 chance. Could you please a test in the PR to cover for the new (non
 trivial) logic?
-- 
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/0107018f1a4cce1d-e9ad3237-b3ae-4e18-90cd-a89558dd331c-00%40eu-central-1.amazonses.com.


[Django] #35407: Cache Model._meta.swapped

2024-04-26 Thread Django
#35407: Cache Model._meta.swapped
-+-
   Reporter:  Adam   |  Owner:  nobody
  Johnson|
   Type: | Status:  new
  Cleanup/optimization   |
  Component:  Database   |Version:  dev
  layer (models, ORM)|
   Severity:  Normal |   Keywords:
   Triage Stage: |  Has patch:  1
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Another candidate for caching, like #35232 before.

 The `Model._meta.swapped` property returns the model that this one has
 been swapped for. Since most models are not swappable (only `auth.User` is
 officially swappable), it returns `None` in nearly all cases.

 I found this property was the most called function in Django when
 profiling a subset of Django’s tests, with:

 {{{
 $ python -m cProfile -o profile runtests.py --parallel 1 *model*

 $ python -m pstats profile <<< 'sort ncalls
 stats 1' | less
 }}}

 This showed 439,484 calls to `swapped`, taking 29ms of the 5.597s test
 run, or 0.5% of the total runtime.

 After adding `@cached_property`, this is reduced to 3,653 calls, rounding
 down to 0ms.
-- 
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/0107018f19ae54dc-c924e0b2-ab39-4b00-b808-b9e886fe2996-00%40eu-central-1.amazonses.com.