TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Pydantic V2 rewritten in Rust is 5-50x faster than Pydantic V1

137 点作者 bratao大约 2 年前

7 条评论

lucasyvas大约 2 年前
This is fantastic - first hand I have noticed this trend is making working with scripting languages less friendly though.<p>For a Node example, with esbuild, I can no longer ever install packages and assume they will work fine when running under the host (macOS) and Docker VM (Linux).<p>Unless Pydantic is downloading all OS binaries with the package and loading the right one at runtime, this would become a &quot;problem&quot; as well. For those coming strictly from scripting language land, this could screw up their workflow quite a bit. A lot more of these people have never worked with native binaries than you think.<p>I, like many here, understand this basic nuance and would rather my tools be fast. However, I think this is quickly eroding the value of using a dynamic scripting language. The platform portability advantage is completely removed as stuff like this spreads and it makes working with those scripting languages a pain in the ass to the point I wouldn&#x27;t even want to use a scripting language anymore. It becomes totally opaque whether or not your code can actually run on another target.<p>In my case this is OK, but I think I&#x27;m in the minority.
评论 #35493157 未加载
评论 #35494467 未加载
评论 #35493477 未加载
sseagull大约 2 年前
Maybe I&#x27;m just a little skeptical today, but I&#x27;m not super enthusiastic about this.<p>1.) Adding another language significantly increases complexity in general. Now I see several packages (pydantic, pydantic-core, pydantic-settings). Issues can crop up in either language, or in the translation.<p>2.) Your typical users are python developers, many which don&#x27;t know rust, and therefore would be unable&#x2F;unwilling to help contribute or help debug issues. Debugging an issue with pure python is easier (ctrl-click in my IDE will take me to the code and I can look and see what is going on, add print statements, etc, even in external libraries).<p>3.) At least in my use cases (and we use pydantic quite a bit), performance increases there will be negligible compared to things like data transfer (network, db) and the rest of my code that&#x27;s written in python.<p>Anyway, I do love pydantic, and hope this is just a drop-in replacement and I don&#x27;t have too many issues.
评论 #35494116 未加载
评论 #35492888 未加载
评论 #35492805 未加载
评论 #35494139 未加载
评论 #35503812 未加载
评论 #35497992 未加载
simon04大约 2 年前
Related: Ruff, a fast Python linter, written in Rust, claiming to be 10-100x faster than existing linters.<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=34788020" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=34788020</a> and <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=32666035" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=32666035</a>
mau大约 2 年前
Congratulations to the team, Pydantic is an amazing library.<p>If you find JSON serialization&#x2F;deserialization a bottleneck, another interesting library (with much less features) for Python is msgspec: <a href="https:&#x2F;&#x2F;github.com&#x2F;jcrist&#x2F;msgspec">https:&#x2F;&#x2F;github.com&#x2F;jcrist&#x2F;msgspec</a>
评论 #35494504 未加载
评论 #35494089 未加载
moving_at_43234大约 2 年前
strange timing, I just pivoted from pydantic to rust&#x27;s serde due to speed.
评论 #35499610 未加载
jerrygenser大约 2 年前
Link to pydantic v2 plan on the blog post is broken.<p>Great job team can&#x27;t wait to use it!
gabereiser大约 2 年前
Soooo, we go from a schema def (my model) to a pydantic-core schema (for use in rust) to a json schema (to send to the user).<p>I feel like this is a huge leap backwards… I was a huge fan of pydantic when merging your models with SQLAlchemy to build rest API’s but having to have rust around to build is a show stopper for me. Good luck.
评论 #35493410 未加载