[
https://issues.apache.org/jira/browse/IGNITE-29089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18121245#comment-18121245
]
Nikolay Izhikov commented on IGNITE-29089:
------------------------------------------
!screenshot-1.png!
Local benchmarks shows reduce of memory allocation
> Get rid of useless byte array creation during ThinClient marshalling
> --------------------------------------------------------------------
>
> Key: IGNITE-29089
> URL: https://issues.apache.org/jira/browse/IGNITE-29089
> Project: Ignite
> Issue Type: Improvement
> Reporter: Nikolay Izhikov
> Assignee: Nikolay Izhikov
> Priority: Major
> Attachments: screenshot-1.png
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Currently, useless byte array creation happens during each marshalling.
>
> {noformat}
> ClientUtils {
> ....
> /** Write Ignite binary object to output stream. */
> void writeObject(BinaryOutputStream out, Object obj)
> {
> out.writeByteArray(marsh.marshal(obj));
> }
> }
> {noformat}
> This call routes to
> {noformat}
> GridBinaryMarshaller {
> public byte[] marshal(@Nullable Object obj, boolean failIfUnregistered)
> throws BinaryObjectException
> {
> if (obj == null)
> return new byte[] \\{ NULL };
> try (BinaryWriterEx writer = BinaryUtils.binariesFactory.writer(ctx,
> failIfUnregistered))
> {
> writer.marshal(obj);
> return writer.out().arrayCopy();
> }
> }
> {noformat}
>
> which create arrayCopy and writes it to BinaryOutputStream right away.
> We can simplify this and improve memory allocation here.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)