Skip to content

Commit

Permalink
Make Benchmarks better
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfett committed Jun 4, 2024
1 parent 6018f07 commit 6c84681
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Benchmarks/Benchmarks/NIOPosixBenchmarks/Benchmarks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ private let eventLoop = MultiThreadedEventLoopGroup.singleton.next()
let benchmarks = {
let defaultMetrics: [BenchmarkMetric] = [
.mallocCountTotal,
.cpuTotal
.cpuTotal,
.contextSwitches
]

Benchmark(
"TCPEcho",
"TCPEcho pure NIO 1M times",
configuration: .init(
metrics: defaultMetrics,
scalingFactor: .one
Expand All @@ -36,6 +37,19 @@ let benchmarks = {
)
}

Benchmark(
"TCPEcho pure async/await NIO 1M times",
configuration: .init(
metrics: defaultMetrics,
scalingFactor: .one
)
) { benchmark in
try await runTCPEchoAsyncChannel(
numberOfWrites: 1_000_000,
eventLoop: eventLoop
)
}

// This benchmark is only available above 5.9 since our EL conformance
// to serial executor is also gated behind 5.9.
#if compiler(>=5.9)
Expand Down Expand Up @@ -67,7 +81,7 @@ let benchmarks = {
#if compiler(>=6.0)
if #available(macOS 15.0, *) {
Benchmark(
"TCPEchoAsyncChannel using task executor preference",
"TCPEchoAsyncChannel using task executor preference 1M times",
configuration: .init(
metrics: defaultMetrics,
scalingFactor: .one
Expand Down

0 comments on commit 6c84681

Please sign in to comment.