Optimize Dump/Serialize Process
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 250
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with benchmarks/complex.py::test_dump and review the benchmark updates in the referenced 0.31.0-env-support branch. Compare dataclass-wizard's dump timing with the listed libraries and identify the serialization path that needs investigation. Done means improving the reported performance metrics while preserving the existing dump behavior, but the issue does not specify a target or implementation scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100