spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request #21327: [SPARK-24107][CORE][followup] ChunkedByteBuffer.w...
Date Wed, 16 May 2018 16:25:25 GMT
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21327#discussion_r188689311
  
    --- Diff: core/src/main/scala/org/apache/spark/util/io/ChunkedByteBuffer.scala ---
    @@ -63,15 +63,18 @@ private[spark] class ChunkedByteBuffer(var chunks: Array[ByteBuffer])
{
        */
       def writeFully(channel: WritableByteChannel): Unit = {
         for (bytes <- getChunks()) {
    -      val curChunkLimit = bytes.limit()
    +      val originalLimit = bytes.limit()
           while (bytes.hasRemaining) {
    -        try {
    -          val ioSize = Math.min(bytes.remaining(), bufferWriteChunkSize)
    -          bytes.limit(bytes.position() + ioSize)
    -          channel.write(bytes)
    -        } finally {
    -          bytes.limit(curChunkLimit)
    -        }
    +        // If `bytes` is an on-heap ByteBuffer, the JDK will copy it to a temporary direct
    --- End diff --
    
    the caching happens in the JDK code, not some magic inside JVM.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message