Akka.Streams.Tests.Performance.MaterializationBenchmark.GraphWithNestedImportsBuilder C# (CSharp) Метод

GraphWithNestedImportsBuilder() публичный статический Метод

public static GraphWithNestedImportsBuilder ( int numberOfNestedGraphs ) : IRunnableGraph
numberOfNestedGraphs int
Результат IRunnableGraph
        public static IRunnableGraph<NotUsed> GraphWithNestedImportsBuilder(int numberOfNestedGraphs)
        {
            var flow = Flow.Create<NotUsed>().Select(x => x);
            for (var i = 0; i < numberOfNestedGraphs; i++)
                flow = Flow.FromGraph(GraphDsl.Create(flow, (b, f) => new FlowShape<NotUsed, NotUsed>(f.Inlet, f.Outlet)));

            return RunnableGraph.FromGraph(GraphDsl.Create(flow, (b, f) =>
            {
                b.From(Source.Single(NotUsed.Instance))
                    .Via(f)
                    .To(Sink.Ignore<NotUsed>().MapMaterializedValue(_ => NotUsed.Instance));
                return ClosedShape.Instance;
            }));
        }

Usage Example

Пример #1
0
 public void Graph_with_1000_nested_imports() => MaterializationBenchmark.GraphWithNestedImportsBuilder(1000);