[ 
https://issues.apache.org/jira/browse/APEXMALHAR-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15669910#comment-15669910
 ] 

ASF GitHub Bot commented on APEXMALHAR-2178:
--------------------------------------------

Github user ambarishpande closed the pull request at:

    https://github.com/apache/apex-malhar/pull/498


> Unnecessary byte array copy in KryoSerializableStreamCodec
> ----------------------------------------------------------
>
>                 Key: APEXMALHAR-2178
>                 URL: https://issues.apache.org/jira/browse/APEXMALHAR-2178
>             Project: Apache Apex Malhar
>          Issue Type: Improvement
>            Reporter: Vlad Rozov
>              Labels: newbie
>
> {noformat}
>   public Slice toByteArray(T info)
>   {
>     ByteArrayOutputStream os = new ByteArrayOutputStream();
>     Output output = new Output(os);
>     kryo.writeClassAndObject(output, info);
>     output.flush();
>     return new Slice(os.toByteArray(), 0, os.toByteArray().length);
>   }
> {noformat}
> It is not necessary to call os.toByteArray().length as it will result in 
> duplicate copy of the byte array.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to