You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apex.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/11/16 05:45:58 UTC
[jira] [Commented] (APEXMALHAR-2178) Unnecessary byte array copy in
KryoSerializableStreamCodec
[ https://issues.apache.org/jira/browse/APEXMALHAR-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15669522#comment-15669522 ]
ASF GitHub Bot commented on APEXMALHAR-2178:
--------------------------------------------
GitHub user ambarishpande opened a pull request:
https://github.com/apache/apex-malhar/pull/498
APEXMALHAR-2178 Removed unnecessary byte array copy.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ambarishpande/apex-malhar APEXMALHAR-2178
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/apex-malhar/pull/498.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #498
----
commit 75abbe080c02b4faf79e863de766892a3684431b
Author: Ambarish Pande <am...@gmail.com>
Date: 2016-11-16T05:38:28Z
APEXMALHAR-2178 Removed unnecessary byte array copy.
----
> 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)