Skip to content

Add benchmark for Model.objects.bulk_create()#95

Merged
smithdc1 merged 2 commits intodjango:mainfrom
adamchainz:bulk_create
Jan 25, 2026
Merged

Add benchmark for Model.objects.bulk_create()#95
smithdc1 merged 2 commits intodjango:mainfrom
adamchainz:bulk_create

Conversation

@adamchainz
Copy link
Member

@adamchainz adamchainz commented Jan 12, 2026

Re: https://code.djangoproject.com/ticket/36858#comment:1

This benchmark tests the very basics, using a model with just one CharField, like the existing model_create benchmark.

I don't have a working asv setup right now, so only testing on CI. (Which crashed 😢)

@smithdc1 smithdc1 self-assigned this Jan 16, 2026
@adamchainz
Copy link
Member Author

Thanks for the missnig step @smithdc1 !

@smithdc1 smithdc1 merged commit db28f85 into django:main Jan 25, 2026
2 checks passed
@jacobtylerwalls
Copy link
Member

Thanks both, glad this got in.

Do any of our benchmarks mock out the database? It occurred to me we might want (to add) less noisy benchmarks that exclusively focus on Django's SQL generation.

@adamchainz adamchainz deleted the bulk_create branch January 31, 2026 23:02
@adamchainz
Copy link
Member Author

I don't think they do, but that's a good idea! So, basically build a QS and then call its compiler?

@jacobtylerwalls
Copy link
Member

Yep, something like calling as_sql() on the compiler and catching EmptyResultSet? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants