apache / fury

A blazingly fast multi-language serialization framework powered by JIT and zero-copy.
https://fury.apache.org/
Apache License 2.0
3.11k stars 248 forks source link

feat(java): ReplaceResolveSerializer deep copy #1925

Closed zhaommmmomo closed 2 weeks ago

zhaommmmomo commented 2 weeks ago

What does this PR do?

Adjusting the deep copy of ReplaceResolveSerializer.

obj -> writeReplace -> copy -> readResolve -> newObj

Related issues

https://github.com/apache/fury/issues/1849

Does this PR introduce any user-facing change?

Benchmark

chaokunyang commented 2 weeks ago

maybe we could add more complexed copy tests such as copyingCustomReplaceClass1/CustomReplaceClass2/CustomReplaceClass3/CustomReplaceClass4/CustomReplaceClass5/CustomReplaceClass6/SimpleCollectionTest/Subclass1/Subclass2/Subclass3. All test objects in ReplaceResolveSerializerTest could be used for complexed copying tests. In this way, we cann ensure future change won't break this feature.

zhaommmmomo commented 2 weeks ago

maybe we could add more complexed copy tests such as copyingCustomReplaceClass1/CustomReplaceClass2/CustomReplaceClass3/CustomReplaceClass4/CustomReplaceClass5/CustomReplaceClass6/SimpleCollectionTest/Subclass1/Subclass2/Subclass3. All test objects in ReplaceResolveSerializerTest could be used for complexed copying tests. In this way, we cann ensure future change won't break this feature.

There are already some copy test cases for these classes in ReplaceResolveSerializerTest image

chaokunyang commented 2 weeks ago

Some cases are more complicated, maybe we need to add copy tests for all those objects

zhaommmmomo commented 2 weeks ago

Some cases are more complicated, maybe we need to add copy tests for all those objects

Okay, I'll add it later