Opened 4 years ago

Closed 4 years ago

#31758 closed Cleanup/optimization (fixed)

remove BytesToCharFieldConversionMixin

Reported by: Sergey Fedoseev Owned by: Sergey Fedoseev
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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 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)

Change History (4)

comment:1 by Sergey Fedoseev, 4 years ago

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 by Sergey Fedoseev, 4 years ago

Has patch: set

comment:3 by Simon Charette, 4 years ago

Triage Stage: UnreviewedAccepted

comment:4 by GitHub <noreply@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 37389ae9:

Fixed #31758 -- Removed unneeded BytesToCharFieldConversionMixin.

Bug was fixed in mysqlclient 1.3.13.

Note: See TracTickets for help on using tickets.
Back to Top