News for hackers. Stuff that matters.
Re:Keep Pydantic out of your Domain Layer by yedpodtrzitko on Saturday July 26, 2025 @07:53AM (#44693375)
Just because it's written in Rust it doesnt mean it's fast. I was working on a project where Pydantic was the bottleneck - there were multiple levels of nested Pydantic objects, and creating the instances was very slow due to the validation which is performed on input values. Even after disablign the validation, dataclasses were twice as fast, compiling the dataclasses with mypyc improved the performance ten times.
Re:Keep Pydantic out of your Domain Layer by ensignavenger on Saturday July 26, 2025 @09:42AM (#44694034)
Were you using v2?

Pydantic docs do clearly state that multple levels of nesting of Pydantic objects can make it much slower, so it isn't particularly surprising that such models were slow.