From 6932012007605df3456e829b5a5fd8f12fd9e701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Endre=20S=C3=A1ndor=20Varga?= Date: Tue, 7 Jun 2016 14:25:04 +0200 Subject: [PATCH] Reduce internal allocation in ActorGraphInterpreter --- .../akka/stream/impl/fusing/ActorGraphInterpreter.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/akka-stream/src/main/scala/akka/stream/impl/fusing/ActorGraphInterpreter.scala b/akka-stream/src/main/scala/akka/stream/impl/fusing/ActorGraphInterpreter.scala index 1258ec103a..3f6c9a0de8 100644 --- a/akka-stream/src/main/scala/akka/stream/impl/fusing/ActorGraphInterpreter.scala +++ b/akka-stream/src/main/scala/akka/stream/impl/fusing/ActorGraphInterpreter.scala @@ -553,11 +553,11 @@ private[stream] class ActorGraphInterpreter(_initial: GraphInterpreterShell) ext private val eventLimit: Int = _initial.mat.settings.syncProcessingLimit private var currentLimit: Int = eventLimit //this is a var in order to save the allocation when no short-circuiting actually happens - private var shortCircuitBuffer: util.LinkedList[Any] = null + private var shortCircuitBuffer: util.ArrayDeque[Any] = null def enqueueToShortCircuit(input: Any): Unit = { - if (shortCircuitBuffer == null) shortCircuitBuffer = new util.LinkedList[Any]() - shortCircuitBuffer.add(input) + if (shortCircuitBuffer == null) shortCircuitBuffer = new util.ArrayDeque[Any]() + shortCircuitBuffer.addLast(input) } def registerShell(shell: GraphInterpreterShell): ActorRef = {