4 ms·
Pydantic 2.0
- minimaxir 3y agoThis is a significant major release as it's a rewrite with Rust bindings in Python, which apparently results in a massive speed increase.
- sseagull 3y agoIt's also causing me lots of errors in my CI, since it's not completely backwards compatible. So I guess I am pinning <2.0 for now and will need to take an afternoon at some point to sort it all out.
- jammycrisp 3y agoWhile it's definitely much faster than pydantic V1 (which is a huge accomplishment!), it's still not exactly what I'd call "fast". I maintain msgspec (https://github.com/jcrist/msgspec https://github.com/jcrist/msgspec), a serialization/validation library which provides similar functionality to pydantic. Recent benchmarks of pydantic V2 against msgspec show msgspec is still 15-30x faster at JSON encoding, and 6-15x faster at JSON decoding/validating. Benchmark (and conversation with Samuel) here: https://gist.github.com/jcrist/d62f450594164d284fbea957fd48b743?permalink_comment_id=4612531#gistcomment-4612531 https://gist.github.com/jcrist/d62f450594164d284fbea957fd48b... This is not to diminish the work of the pydantic team! For many users pydantic will be more than fast enough, and is definitely a more feature-filled tool. It's a good library, and people will be happy using it! But pydantic is not the only tool in this space, and rubbing some rust on it doesn't necessarily make it "fast".