ryerraguntla commented on code in PR #2933:
URL: https://github.com/apache/iggy/pull/2933#discussion_r3002343634
##########
core/connectors/sdk/src/lib.rs:
##########
@@ -155,6 +157,29 @@ impl Payload {
Payload::FlatBuffer(value) => Ok(value),
}
}
+
+ /// Borrowing serialisation — no clone, no ownership transfer.
+ ///
+ ///Json: serialises the `OwnedValue` in place → one allocation
+ /// for the output `Vec<u8>`, zero clone of the value tree.
+ ///Raw: returns a copy of the inner bytes (unavoidable — caller
+ /// needs owned bytes and we only have a reference).
+ ///Text/`Proto: copies the string bytes (same reasoning).
+ ///FlatBuffer: copies the buffer bytes.
+ ///
+ /// For `Json` this replaces a deep clone of the entire `OwnedValue` tree
+ /// with a single serialisation pass — O(n) work either way, but the clone
+ /// path does O(n) allocation + O(n) serialisation, while this path does
+ /// only O(n) serialisation.
Review Comment:
changed to try_to_bytes()
--
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]