4 ms·
> Dataclasses and Pydantic models are slow to construct Citation needed? Pydantic is really quite fast, and you can pass raw JSON responses into it. It may be
by orf 2y ago
> Dataclasses and Pydantic models are slow to construct
Citation needed? Pydantic is really quite fast, and you can pass raw JSON responses into it.
It may be slower (depending on the validators or structure), but I’d expect it to be comparably fast to the stdlib JSON module.
- FreakLegion 2y agoPydantic's JSON parsing is faster than the built-in module, on par with orjson, but creating model instances and run-time type checking net out to be much slower. I linked msgspec's benchmarks in the previous post.
- newaccountman2 2y ago> Citation needed? Pydantic is really quite fast Pydantic v1 was slow enough for them to write a lot of the core logic in Rust for Pydantic v2, and for the previous sloth to have been an argument people launched against it if you look back at threads on here and Reddit comparing it to other libraries.