reducing array load pressure by making connections an explicit object
This commit is contained in:
parent
3a1a0cc4c4
commit
b8ceb863c9
8 changed files with 220 additions and 153 deletions
|
|
@ -71,17 +71,17 @@ trait GraphInterpreterSpecKit extends StreamSpec {
|
|||
def init(): Unit = {
|
||||
val assembly = buildAssembly()
|
||||
|
||||
val (inHandlers, outHandlers, logics) =
|
||||
val (conns, logics) =
|
||||
assembly.materialize(Attributes.none, assembly.stages.map(_.module), new java.util.HashMap, _ ⇒ ())
|
||||
_interpreter = new GraphInterpreter(assembly, NoMaterializer, logger, inHandlers, outHandlers, logics,
|
||||
_interpreter = new GraphInterpreter(assembly, NoMaterializer, logger, logics, conns,
|
||||
(_, _, _) ⇒ (), fuzzingMode = false, null)
|
||||
|
||||
for ((upstream, i) ← upstreams.zipWithIndex) {
|
||||
_interpreter.attachUpstreamBoundary(i, upstream._1)
|
||||
_interpreter.attachUpstreamBoundary(conns(i), upstream._1)
|
||||
}
|
||||
|
||||
for ((downstream, i) ← downstreams.zipWithIndex) {
|
||||
_interpreter.attachDownstreamBoundary(i + upstreams.size + connections.size, downstream._2)
|
||||
_interpreter.attachDownstreamBoundary(conns(i + upstreams.size + connections.size), downstream._2)
|
||||
}
|
||||
|
||||
_interpreter.init(null)
|
||||
|
|
@ -89,9 +89,9 @@ trait GraphInterpreterSpecKit extends StreamSpec {
|
|||
}
|
||||
|
||||
def manualInit(assembly: GraphAssembly): Unit = {
|
||||
val (inHandlers, outHandlers, logics) =
|
||||
val (connections, logics) =
|
||||
assembly.materialize(Attributes.none, assembly.stages.map(_.module), new java.util.HashMap, _ ⇒ ())
|
||||
_interpreter = new GraphInterpreter(assembly, NoMaterializer, logger, inHandlers, outHandlers, logics,
|
||||
_interpreter = new GraphInterpreter(assembly, NoMaterializer, logger, logics, connections,
|
||||
(_, _, _) ⇒ (), fuzzingMode = false, null)
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ trait GraphInterpreterSpecKit extends StreamSpec {
|
|||
|
||||
// Modified onPush that does not grab() automatically the element. This accesses some internals.
|
||||
override def onPush(): Unit = {
|
||||
val internalEvent = interpreter.connectionSlots(portToConn(in.id))
|
||||
val internalEvent = portToConn(in.id).slot
|
||||
|
||||
internalEvent match {
|
||||
case Failed(_, elem) ⇒ lastEvent += OnNext(DownstreamPortProbe.this, elem)
|
||||
|
|
@ -224,8 +224,8 @@ trait GraphInterpreterSpecKit extends StreamSpec {
|
|||
outOwners = Array(-1))
|
||||
|
||||
manualInit(assembly)
|
||||
interpreter.attachDownstreamBoundary(0, in)
|
||||
interpreter.attachUpstreamBoundary(0, out)
|
||||
interpreter.attachDownstreamBoundary(interpreter.connections(0), in)
|
||||
interpreter.attachUpstreamBoundary(interpreter.connections(0), out)
|
||||
interpreter.init(null)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue