#31758: remove BytesToCharFieldConversionMixin
-------------------------------------+-------------------------------------
               Reporter:  Sergey     |          Owner:  nobody
  Fedoseev                           |
                   Type:             |         Status:  new
  Cleanup/optimization               |
              Component:  Database   |        Version:  master
  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          |
-------------------------------------+-------------------------------------
 `BytesToCharFieldConversionMixin` was added in
 6141c752fe7091d2197f5ac061300a9e0a36b09b in order to fix #29251. It looks
 like the issue was caused by bug in mysqlclient and was fixed in
 [https://github.com/PyMySQL/mysqlclient-
 python/commit/73ccdcdddf2dd8e193e8af4a2362727c601b40ac 1.3.13]. Since we
 support mysqlclient >= 1.4, `BytesToCharFieldConversionMixin` could be
 removed.

 This makes `Repeat` faster. Benchmarked on postgres with 10000 rows.
 Before:

 {{{
 In [8]: %timeit
 list(TestModel.objects.values_list(models.functions.Repeat(models.Value('a'),
 2)))
 18.1 ms ± 170 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
 }}}

 After:
 {{{
 In [3]: %timeit
 list(TestModel.objects.values_list(models.functions.Repeat(models.Value('a'),
 2)))
 3.18 ms ± 28.5 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31758>
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/053.56599dff142956ed622d55eb7a81b3e5%40djangoproject.com.

Reply via email to