Comment

Comment by sijokun

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

parent sijokun 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton