|
|
|
|
|
by sijokun
238 days ago
|
|
I ran into memory issues with a high-load project so I built a compact binary encoder/decoder for Pydantic models. It cut in-RAM object size by up to 7× vs json.dumps(), and ended up saving the whole service from collapsing. GitHub: https://github.com/sijokun/PyByntic Works with annotated Pydantic models and gives you:
– .serialize() -> bytes
– .deserialize(bytes) -> Model Curious to hear whether others here have hit similar problems and how you solved it? P.S. Project was a Telegram MiniApp with 10m+ MAU, we were storing cached user objects in Redis Cluster |
|
This would have been a super nice to have back then.
I wonder though how much sense it would make to get something like this mainlined into upstream Pydantic? as having this downstream would give many continuity and dependency lock concerns. And having it as part of the main library would significantly drive adoption rate.