diff options
author | Liwei Lin <lwlin7@gmail.com> | 2016-09-07 10:04:00 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-09-07 10:04:00 +0100 |
commit | 3ce3a282c8463408f9a2db93c1748e8df8087e07 (patch) | |
tree | 7814535174f3ef7294cfd20e4dfeae28fecd4693 /streaming/src/main/scala/org | |
parent | 9fccde4ff80fb0fd65a9e90eb3337965e4349de4 (diff) | |
download | spark-3ce3a282c8463408f9a2db93c1748e8df8087e07.tar.gz spark-3ce3a282c8463408f9a2db93c1748e8df8087e07.tar.bz2 spark-3ce3a282c8463408f9a2db93c1748e8df8087e07.zip |
[SPARK-17359][SQL][MLLIB] Use ArrayBuffer.+=(A) instead of ArrayBuffer.append(A) in performance critical paths
## What changes were proposed in this pull request?
We should generally use `ArrayBuffer.+=(A)` rather than `ArrayBuffer.append(A)`, because `append(A)` would involve extra boxing / unboxing.
## How was this patch tested?
N/A
Author: Liwei Lin <lwlin7@gmail.com>
Closes #14914 from lw-lin/append_to_plus_eq_v2.
Diffstat (limited to 'streaming/src/main/scala/org')
-rw-r--r-- | streaming/src/main/scala/org/apache/spark/streaming/util/BatchedWriteAheadLog.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/streaming/src/main/scala/org/apache/spark/streaming/util/BatchedWriteAheadLog.scala b/streaming/src/main/scala/org/apache/spark/streaming/util/BatchedWriteAheadLog.scala index 71f3304f1b..35f0166ed0 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/util/BatchedWriteAheadLog.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/util/BatchedWriteAheadLog.scala @@ -157,7 +157,7 @@ private[util] class BatchedWriteAheadLog(val wrappedLog: WriteAheadLog, conf: Sp /** Write all the records in the buffer to the write ahead log. */ private def flushRecords(): Unit = { try { - buffer.append(walWriteQueue.take()) + buffer += walWriteQueue.take() val numBatched = walWriteQueue.drainTo(buffer.asJava) + 1 logDebug(s"Received $numBatched records from queue") } catch { |