Skip to content

Commit 5b887d2

Browse files
committed
adding docs and poisson disk benchmark
1 parent a73fe79 commit 5b887d2

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

ExternalBenchmarks/.benchmarkBaselines/ExternalBenchmarks/bdb4ef08/results.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

ExternalBenchmarks/Benchmarks/ExternalBenchmarks/ExternalBenchmarks.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,19 @@ let benchmarks = {
1919
Benchmark.defaultConfiguration.maxDuration = .seconds(1) // Default = 1 second
2020
Benchmark.defaultConfiguration.metrics = [.throughput, .wallClock]
2121

22+
Benchmark("disk2d") { benchmark in
23+
var poisson = DiskSampler2D(seed: 0)
24+
for _ in benchmark.scaledIterations {
25+
blackHole(poisson.generate(radius: 10, width: viewer_size, height: viewer_size))
26+
}
27+
}
28+
2229
Benchmark("cell2d") { benchmark in
2330
for _ in benchmark.scaledIterations {
2431
blackHole(CellNoise2D(amplitude: 255, frequency: 0.01))
2532
}
2633
}
34+
2735
Benchmark("cell3d") { benchmark in
2836
for _ in benchmark.scaledIterations {
2937
blackHole(CellNoise3D(amplitude: 255, frequency: 0.01))

ExternalBenchmarks/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,39 @@ in order avoid adding transitive dependencies.
88
To run the benchmarks, invoke the following command:
99

1010
swift package benchmark
11+
12+
## Using Benchmarks
13+
14+
- [Documentation for the package](https://swiftpackageindex.com/ordo-one/package-benchmark/documentation/benchmark/gettingstarted)
15+
- [Creating and Comparing Baselines](https://swiftpackageindex.com/ordo-one/package-benchmark/documentation/benchmark/creatingandcomparingbaselines)
16+
- [Exporting Benchmark Results](https://swiftpackageindex.com/ordo-one/package-benchmark/documentation/benchmark/exportingbenchmarks)
17+
18+
## Baselines
19+
20+
The baselines are set by commit hash (first 8 hex characters) or (in the future) tag with this work in place.
21+
The initial baseline is `bdb4ef08`.
22+
It builds on the tag `1.0.0` with updates to dependencies and Swift versions and no functional code changes.
23+
24+
```bash
25+
swift package --allow-writing-to-package-directory benchmark baseline update bdb4ef08
26+
```
27+
28+
To compare current development branch against this baseline, run the following command from this sub-project in the terminal:
29+
30+
```bash
31+
swift package benchmark baseline compare bdb4ef08
32+
```
33+
34+
The output defaults to plain text. If you'd like markdown output, for pasting into a pull request, add `--format markdown` to the command.
35+
36+
For a summary comparison, use the command:
37+
38+
```bash
39+
swift package benchmark baseline check --check-absolute
40+
```
41+
42+
### Stored Baselines
43+
44+
`bdb4ef08`: M1 macbook pro, 16GB ram, running only iTerm2
45+
46+

0 commit comments

Comments
 (0)