Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(python): get object __dict__ for faster field read/write (#2003)
## What does this PR do? This PR extract `__dict__` in object when serialize a dataclass without slots for faster attribute set/set by 16% ## Related issues <!-- Is there any related issue? Please attach here. - #xxxx0 - #xxxx1 - #xxxx2 --> ## Does this PR introduce any user-facing change? <!-- If any user-facing interface changes, please [open an issue](https://github.com/apache/fury/issues/new/choose) describing the need to do so and update the document if necessary. --> - [ ] Does this PR introduce any public API change? - [ ] Does this PR introduce any binary protocol compatibility change? ## Benchmark For following object: ```python COMPLEX_OBJECT = ComplexObject1( f1=ComplexObject2(f1=True, f2={-1: 2}), f2="abc", f3=["abc", "abc"], f4={1: 2}, f5=2**7 - 1, f6=2**15 - 1, f7=2**31 - 1, f8=2**63 - 1, f9=1.0 / 2, f10=1 / 3.0, f12=[-1, 4], ) ``` This PR gives a 16% speed up
- Loading branch information