Skip to content

Commit

Permalink
docs: Update readme to fix broken example benchmark (#299)
Browse files Browse the repository at this point in the history
Updates readme to fix the broken benchmark example, fixes #295 which contains more information.
  • Loading branch information
lehtihet authored Nov 18, 2024
1 parent 87b08bf commit 9599dac
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -107,7 +117,7 @@ let benchmarks = {
for await _ in taskGroup {
}
})
}
}
}
```

Expand Down

0 comments on commit 9599dac

Please sign in to comment.