This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury.git


The following commit(s) were added to refs/heads/main by this push:
     new 7517c23c chore(java): add fury deep copy documentation (#1773)
7517c23c is described below

commit 7517c23c3964d2ed948ba5deeda2057ff5e1b8bb
Author: Shawn Yang <[email protected]>
AuthorDate: Sat Jul 27 18:29:24 2024 +0800

    chore(java): add fury deep copy documentation (#1773)
    
    ## What does this PR do?
    
    add fury deep copy documentation
    
    ## Related issues
    
    Closes #1772
    
    ## 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
    
    <!--
    When the PR has an impact on performance (if you don't know whether the
    PR will have an impact on performance, you can submit the PR first, and
    if it will have impact on performance, the code reviewer will explain
    it), be sure to attach a benchmark data here.
    -->
---
 docs/guide/java_serialization_guide.md | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/docs/guide/java_serialization_guide.md 
b/docs/guide/java_serialization_guide.md
index 2cca181a..de179f41 100644
--- a/docs/guide/java_serialization_guide.md
+++ b/docs/guide/java_serialization_guide.md
@@ -79,10 +79,10 @@ import org.apache.fury.config.*;
 public class Example {
   // reuse fury.
   private static final ThreadSafeFury fury = new ThreadLocalFury(classLoader 
-> {
-      Fury f = Fury.builder().withLanguage(Language.JAVA)
-              .withClassLoader(classLoader).build();
-      f.register(SomeClass.class);
-      return f;
+    Fury f = Fury.builder().withLanguage(Language.JAVA)
+      .withClassLoader(classLoader).build();
+    f.register(SomeClass.class);
+    return f;
   });
 
   public static void main(String[] args) {
@@ -115,6 +115,7 @@ public class Example {
 | `codeGenEnabled`                    | Disabling may result in faster initial 
serialization but slower subsequent serializations.                             
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
 | `asyncCompilationEnabled`           | If enabled, serialization uses 
interpreter mode first and switches to JIT serialization after async serializer 
JIT for a class is finished.                                                    
                                                                                
                                                                                
                                                                                
                      [...]
 | `scalaOptimizationEnabled`          | Enables or disables Scala-specific 
serialization optimization.                                                     
                                                                                
                                                                                
                                                                                
                                                                                
                  [...]
+| `copyRef`                           | When disabled, the copy performance 
will be better. But fury deep copy will ignore circular and shared reference. 
Same reference of an object graph will be copied into different objects in one 
`Fury#copy`.                                                                    
                                                                                
                                                                                
                    [...]
 
 ## Advanced Usage
 
@@ -192,6 +193,29 @@ not worthy compared to performance cost. Maybe you should 
try to disable long co
 much
 space savings.
 
+### Object deep copy
+
+Deep copy example:
+
+```java
+Fury fury=Fury.builder()
+  ...
+  .withRefCopy(true).build();
+  SomeClass a=xxx;
+  SomeClass copied=fury.copy(a)
+```
+
+Make fury deep copy ignore circular and shared reference, this deep copy mode 
will ignore circular and shared reference.
+Same reference of an object graph will be copied into different objects in one 
`Fury#copy`.
+
+```java
+Fury fury=Fury.builder()
+  ...
+  .withRefCopy(false).build();
+  SomeClass a=xxx;
+  SomeClass copied=fury.copy(a)
+```
+
 ### Implement a customized serializer
 
 In some cases, you may want to implement a serializer for your type, 
especially some class customize serialization by


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to