Github user jerryshao commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4878#discussion_r25748317
  
    --- Diff: 
core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala ---
    @@ -721,13 +721,13 @@ private[spark] class ExternalSorter[K, V, C](
           // this simple we spill out the current in-memory collection so that 
everything is in files.
           spillToPartitionFiles(if (aggregator.isDefined) map else buffer)
           partitionWriters.foreach(_.commitAndClose())
    -      var out: FileOutputStream = null
    -      var in: FileInputStream = null
    +      var out: OutputStream = null
    +      var in: InputStream = null
           val writeStartTime = System.nanoTime
           try {
    -        out = new FileOutputStream(outputFile, true)
    +        out = new BufferedOutputStream(new FileOutputStream(outputFile, 
true))
             for (i <- 0 until numPartitions) {
    -          in = new FileInputStream(partitionWriters(i).fileSegment().file)
    +          in = new BufferedInputStream(new 
FileInputStream(partitionWriters(i).fileSegment().file))
    --- End diff --
    
    Did you test the performance difference while changing to 
`BufferedInputStream`, as I know here internally uses NIO's `transferTo` to 
copy the memory mapped file, so I think buffer actually not useful because it 
doesn't use traditional IO. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to