-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Housekeeping] Use msgspec instead of marshmallow and related dependencies #4485
Comments
🤖 It seems like you've got this under control, if you want help or have specific questions, let me know what I can do for you! |
Hi, author of mashumaro here 👋 Just to make it clear, mashumaro, which is currently used in flytekit according to the docs, supports dataclasses out of the box (and don't force you to use mixins since the recent 3.11 release) and don't depend on any library except typing-extensions (for compatibility reasons). It has nothing to do with marshmallow, marshmallow-jsonschema or marshmallow-enum in favour of built-in JSON Schema generation functionality and standard Enum types support.
Their outdated comparison uses Struct classes written in C for msgspec, and that's why everyone can see the impressive results. If you stick to dataclasses, msgspec won't give you that performance advantage and will run at about the same speed as the others. I encourage you to write your own benchmark to see the difference before making a decision. |
Thank you for sharing!
If there is no performance differences for dataclasses, then this proposal is more about reducing the overall dependencies. I suspect we can leverage Looking over mashumaro, it looks like we can use |
Thanks for considering msgspec! Apologies for stepping into the conversation here - I try not to weigh in on library comparison discussions when unasked, but I'm just going to add a quick comment here to correct a misconception above.
While our internal benchmarks are a bit outdated, this claim doesn't hold up even when run today. It's true that part of msgspec's performance comes from its own fast To demonstrate this, I hacked together a quick benchmark based on the one used in this flyte blogpost. The source may be found in this gist. Results:
When using mashumaro with no other dependencies, msgspec is roughly 7-12x faster at encoding/decoding JSON. If you include mashumaro's optional That said - I'm not familiar with If you do decide that |
#take |
With flyteorg/flytekit#2080, we have users that depend on With that in mind, I'll close this issue around migrating to |
Describe the issue
Currently, serializing we are using many libraries to serialize objects in
flytekit
:This can all be replaced by replaced by https://github.com/jcrist/msgspec, which has not dependencies itself.
msgspec
contains all the features needed above.Benchmarks could be outdated.msgspec
has run benchmarks that show favorable results compared to the popular serialization frameworks.dataclasses_json
#4486, which proposes to removedataclasses_json
.What if we do not do this?
Continue to depend on multiple libraries for serialization.
Related component(s)
flytekit
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: