You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2018/12/12 08:29:51 UTC
[GitHub] 10110346 commented on a change in pull request #23296:
[mllib]MergeAggregate serialize and deserialize function use Bytebuffer to
optimize
10110346 commented on a change in pull request #23296: [mllib]MergeAggregate serialize and deserialize function use Bytebuffer to optimize
URL: https://github.com/apache/spark/pull/23296#discussion_r240918718
##########
File path: mllib/src/main/scala/org/apache/spark/ml/stat/Summarizer.scala
##########
@@ -609,16 +611,16 @@ private[ml] object SummaryBuilderImpl extends Logging {
= new SummarizerBuffer(requestedMetrics, requestedComputeMetrics)
override def serialize(state: SummarizerBuffer): Array[Byte] = {
- // TODO: Use ByteBuffer to optimize
- val bos = new ByteArrayOutputStream()
+ // Use ByteBuffer
+ val bos = new ByteBufferOutputStream()
val oos = new ObjectOutputStream(bos)
oos.writeObject(state)
bos.toByteArray
Review comment:
`bos.toByteArray` has a data copy.
`bos.toByteArray => bos.toByteBuffer.array`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org