Skip to content

Optimize bootstrap_devsite command#2052

Merged
tykling merged 7 commits intobornhack:mainfrom
0xUnicorn:optimize-bootstrap-devsite
Feb 19, 2026
Merged

Optimize bootstrap_devsite command#2052
tykling merged 7 commits intobornhack:mainfrom
0xUnicorn:optimize-bootstrap-devsite

Conversation

@0xUnicorn
Copy link
Contributor

I got annoyed that bootstrapping the database took 4m9s on my Ryzen 5 3900X, so I implemented bulk_create which only took off 23s.

I then learned about concurrency and implemented threading with cleaner boundaries and got it down to 1m50s.

Adding a transaction.atomic() context manager shaved off another 10-15s ending at 1m35s.

This was a nice exercise for learning about optimization and django-admin commands

- Allow to customize camp years created/read_only by specifying ranges.

- Implement concurrency using threading with 4 default threads (best performance) [NOT TESTED ON WINDOWS].

- Restructure Bootstrap class methods for improving boundaries.

- Write some tests for `bootstrap_devsite` command's new behaviour.
- Verbosity arg is implemented in Django and can be used to silence noisy DEBUG/INFO logs

- Improve logging methods, add and use more colors and move some logging from `bootstrap.base` to `bootstrap_devsite`.

- Fix hardcoded default range ending.
@tykling
Copy link
Member

tykling commented Feb 19, 2026

very nice 🚀

@tykling tykling merged commit 24f0767 into bornhack:main Feb 19, 2026
1 of 2 checks passed
@0xUnicorn 0xUnicorn deleted the optimize-bootstrap-devsite branch February 19, 2026 08:31
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.

2 participants

Comments