From 9599dac767077a7e9102659cf80fc264fbeb9413 Mon Sep 17 00:00:00 2001 From: lehtihet <60138988+lehtihet@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:00:23 +0100 Subject: [PATCH] docs: Update readme to fix broken example benchmark (#299) Updates readme to fix the broken benchmark example, fixes #295 which contains more information. --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 346d9f92..cf70f448 100644 --- a/README.md +++ b/README.md @@ -95,9 +95,19 @@ let benchmarks = { // measure something here } + func defaultCounter() -> Int { + 10 + } + + func dummyCounter(_ count: Int) { + for index in 0 ..< count { + blackHole(index) + } + } + Benchmark("All metrics, full concurrency, async", configuration: .init(metrics: BenchmarkMetric.all, - maxDuration: .seconds(10)) { benchmark in + maxDuration: .seconds(10))) { benchmark in let _ = await withTaskGroup(of: Void.self, returning: Void.self, body: { taskGroup in for _ in 0..<80 { taskGroup.addTask { @@ -107,7 +117,7 @@ let benchmarks = { for await _ in taskGroup { } }) - } + } } ```