Cybermaxke opened a new pull request, #2101:
URL: https://github.com/apache/fury/pull/2101

   ## What does this PR do?
   
   Try to use `System.arraycopy` when copying between byte arrays. This 
significantly increases performance, in our use case serialization is twice as 
fast (serializing/deserializing 1M complex strucutures using 
(de)serializeJavaObject in parallel). When using Platform.copyMemory, the JDK 
is doing a lot of type checking to see if it's a byte array, causing a visible 
slowdown. `Unsafe.memoryCopy` implementation was changed in Java 9 from a 
native method to a method calling the internal unsafe method containing the 
reflection checks.
   
   There are a few places where System.arraycopy is already used, referring to 
it being faster on certain JDK implementations. Tested on a macbook with arm64 
cpu against zulu 21 and open-jdk 23. 
   
   
![image](https://github.com/user-attachments/assets/ce4a2c9d-e7b7-49ae-867d-68eadbe8a140)
   
   ## Does this PR introduce any user-facing change?
   
   - [ ] Does this PR introduce any public API change?
   - [ ] Does this PR introduce any binary protocol compatibility change?
   
   ## Benchmark
   I tried to reproduce the performance impact through one on existing 
benchmarks `UserTypeSerializeSuite.fury_serialize`, however I didn't see a 
difference here.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to