Opened 6 weeks ago

Closed 6 weeks ago

#28686 closed Cleanup/optimization (invalid)

QuerySet.bulk_create() doesn't need to convert the input objs into list

Reported by: Michael Lee Owned by: nobody
Component: Database layer (models, ORM) Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I checked and found that in this commit,

https://github.com/django/django/commit/8adc59038cdc6ce4f9170e4de2d716d940e136b3#diff-5b0dda5eb9a242c15879dc9cd2121379R430

The objs are converted to list. But if objs is actually a huge generator, then possibly the performance would be hugely degraded ?

Maybe we could simply remove the the list conversion ?

Change History (1)

comment:1 Changed 6 weeks ago by Tim Graham

Component: UncategorizedDatabase layer (models, ORM)
Resolution: invalid
Status: newclosed

Without the list() call, generators no longer work properly. Try running Django's test suite and you'll see some test failures. Feel free to reopen the ticket if you can provide a patch that passes the tests.

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