=str - Various internal Akka Stream improvements

* Gives Inlets and Outlets a `carbonCopy` method and switches to allocate them via `apply`
* Removes 4 Array allocations per FanIn and uses a bitmasked array instead
* Makes the FlattenStrategy.concat instance a singleton
This commit is contained in:
Viktor Klang 2015-06-13 16:28:38 -04:00
parent 65a425fe0b
commit 2725bfc044
30 changed files with 159 additions and 134 deletions

View file

@ -30,20 +30,16 @@ private[akka] abstract class SourceModule[+Out, +Mat](val shape: SourceShape[Out
// This is okay since the only caller of this method is right below.
protected def newInstance(shape: SourceShape[Out] @uncheckedVariance): SourceModule[Out, Mat]
override def carbonCopy: Module = {
val out = new Outlet[Out](shape.outlet.toString)
newInstance(SourceShape(out))
}
override def carbonCopy: Module = newInstance(SourceShape(shape.outlet.carbonCopy()))
override def subModules: Set[Module] = Set.empty
def amendShape(attr: Attributes): SourceShape[Out] = {
def amendShape(attr: Attributes): SourceShape[Out] =
attr.nameOption match {
case None shape
case s: Some[String] if s == attributes.nameOption shape
case Some(name) shape.copy(outlet = new Outlet(name + ".out"))
case Some(name) shape.copy(outlet = Outlet(name + ".out"))
}
}
}