diff --git a/Benchmarks/Benchmarks/NIOCoreBenchmarks/Benchmarks.swift b/Benchmarks/Benchmarks/NIOCoreBenchmarks/Benchmarks.swift index cea2e10af5..c821b872dd 100644 --- a/Benchmarks/Benchmarks/NIOCoreBenchmarks/Benchmarks.swift +++ b/Benchmarks/Benchmarks/NIOCoreBenchmarks/Benchmarks.swift @@ -21,6 +21,11 @@ let benchmarks = { .mallocCountTotal ] + let leakMetrics: [BenchmarkMetric] = [ + .mallocCountTotal, + .memoryLeaked, + ] + Benchmark( "NIOAsyncChannel.init", configuration: .init( @@ -46,4 +51,28 @@ let benchmarks = { blackHole(asyncChanel) } } + + Benchmark( + "WaitOnPromise", + configuration: .init( + metrics: leakMetrics, + scalingFactor: .kilo, + maxDuration: .seconds(10_000_000), + maxIterations: 10_000 // need 10k to get a signal + ) + ) { benchmark in + // Elide the cost of the 'EmbeddedEventLoop'. + let el = EmbeddedEventLoop() + + benchmark.startMeasurement() + defer { + benchmark.stopMeasurement() + } + + for _ in 0..