netudima commented on code in PR #3761:
URL: https://github.com/apache/cassandra/pull/3761#discussion_r1901172405


##########
src/java/org/apache/cassandra/db/Mutation.java:
##########
@@ -448,7 +451,7 @@ private Serialization serialization(Mutation mutation, int 
version)
                     try (DataOutputBuffer dob = 
DataOutputBuffer.scratchBuffer.get())
                     {
                         serializeInternal(PartitionUpdate.serializer, 
mutation, dob, version);
-                        serialization = new 
CachedSerialization(dob.toByteArray());
+                        serialization = new 
CachedSerialization(dob.unsafeToByteArray());

Review Comment:
   yes, it is reusable, so we have to copy the result
   
   I have one non-implemented idea for this area of logic - initially we invoke 
serializedSize and then if the result is not too big we invoke the real 
serialization. In typical cases mutations are small and we can use some cheaper 
heuristic to decide if it is small to go directy to  real serialization..  



-- 
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