=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:
parent
65a425fe0b
commit
2725bfc044
30 changed files with 159 additions and 134 deletions
|
|
@ -28,9 +28,9 @@ private object PoolConductor {
|
|||
|
||||
override def deepCopy(): Shape =
|
||||
Ports(
|
||||
new Inlet(requestIn.toString),
|
||||
new Inlet(slotEventIn.toString),
|
||||
slotOuts.map(o ⇒ new Outlet(o.toString)))
|
||||
requestIn.carbonCopy(),
|
||||
slotEventIn.carbonCopy(),
|
||||
slotOuts.map(_.carbonCopy()))
|
||||
|
||||
override def copyFromPorts(inlets: immutable.Seq[Inlet[_]], outlets: immutable.Seq[Outlet[_]]): Shape =
|
||||
Ports(
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@ private[http] object MessageToFrameRenderer {
|
|||
case bm: BinaryMessage ⇒ streamedFrames(Opcode.Binary, bm.dataStream)
|
||||
case TextMessage.Strict(text) ⇒ strictFrames(Opcode.Text, ByteString(text, "UTF-8"))
|
||||
case tm: TextMessage ⇒ streamedFrames(Opcode.Text, tm.textStream.transform(() ⇒ new Utf8Encoder))
|
||||
}.flatten(FlattenStrategy.Concat())
|
||||
}.flatten(FlattenStrategy.concat)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,9 +218,9 @@ private[http] object StreamUtils {
|
|||
}
|
||||
|
||||
def oneTimePublisherSink[In](cell: OneTimeWriteCell[Publisher[In]], name: String): Sink[In, Publisher[In]] =
|
||||
new Sink[In, Publisher[In]](new OneTimePublisherSink(none, SinkShape(new Inlet(name)), cell))
|
||||
new Sink[In, Publisher[In]](new OneTimePublisherSink(none, SinkShape(Inlet(name)), cell))
|
||||
def oneTimeSubscriberSource[Out](cell: OneTimeWriteCell[Subscriber[Out]], name: String): Source[Out, Subscriber[Out]] =
|
||||
new Source[Out, Subscriber[Out]](new OneTimeSubscriberSource(none, SourceShape(new Outlet(name)), cell))
|
||||
new Source[Out, Subscriber[Out]](new OneTimeSubscriberSource(none, SourceShape(Outlet(name)), cell))
|
||||
|
||||
/** A copy of PublisherSink that allows access to the publisher through the cell but can only materialized once */
|
||||
private class OneTimePublisherSink[In](attributes: Attributes, shape: SinkShape[In], cell: OneTimeWriteCell[Publisher[In]])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue