Skip to content
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

Optimize Dump/Serialize Process #154

Open
rnag opened this issue Nov 27, 2024 · 0 comments
Open

Optimize Dump/Serialize Process #154

rnag opened this issue Nov 27, 2024 · 0 comments
Labels
Great To Have! Important / Worth Addressing performance self-created Opened by me!

Comments

@rnag
Copy link
Owner

rnag commented Nov 27, 2024

  • Dataclass Wizard version: 0.30.1 (code in this branch)
  • Python version: 3.13.0
  • Operating System: Mac OS

Description

I checked in updates to benchmarks in my other branch and added test cases for other libraries with the help of ChatGPT, since I'm kinda lazy and can't be bothered to do it.

Well, the results are kind of telling (below)

TLDR: Dataclass Wizard asdict is still faster than native dataclasses.asdict() -- which is expected, because I heavily adapted the code for serialization process from dataclasses module -- but it a lot slower than other libraries like e.g. pydantic.

I need to trim the fat and improve it, and I have an idea of how to do/achieve that. This issue is here to track that effort, and remind me of performance metrics (among others).

Results

benchmarks/complex.py::test_dump 
--------------------------------- live log call ---------------------------------
benchmarks.complex.complex - [INFO] dataclass-wizard     1.592520
benchmarks.complex.complex - [INFO] asdict (dataclasses) 2.038759
benchmarks.complex.complex - [INFO] dataclass-factory    0.977191
benchmarks.complex.complex - [INFO] dataclasses-json     12.763810
benchmarks.complex.complex - [INFO] mashumaro            0.286038
benchmarks.complex.complex - [INFO] pydantic             0.367974
benchmarks.complex.complex - [INFO] jsons                42.078253
benchmarks.complex.complex - [INFO] jsons (strict)       41.175316
@rnag rnag added performance Great To Have! Important / Worth Addressing self-created Opened by me! labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Great To Have! Important / Worth Addressing performance self-created Opened by me!
Projects
None yet
Development

No branches or pull requests

1 participant