-
-
Notifications
You must be signed in to change notification settings - Fork 517
Description
Describe the bug
A clear and concise description of what the bug is.
Hi, during a dependencies upgrade work, upgrading both ninja and pydantic to last version (1.4, 2.11)
I've seen up to x2.5 in terms of memory allocation, in my case 1.2 GB, with pydantic 2.10 I was at 510 MB, at this point I don't know if it's ninja or pydantic istelf but i've seen that pydantic._internal._model_construction.complete_model_class
/ pydantic.plugin._schema_validator.create_schema_validator are
memory intensive
A bit weird because 2.11 claim is to reduce memory allocation..
I've used memray to have some flamegraph representation:
Before (2.10):
After (2.11)
Versions (please complete the following information):
- Python version: 3.13
- Django version: 5.0.14
- Django-Ninja version: 1.4.1
- Pydantic version: 2.10/2.11
Note you can quickly get this by runninng in ./manage.py shell
this line:
import django; import pydantic; import ninja; django.__version__; ninja.__version__; pydantic.__version__