README.md
1# Introduction
2
3A Gradle Plugin to build and generate benchmarking results for KMP iOS benchmarks.
4
5* Generates Skia Dashboard compatible results.
6* Automatically generates the XCode project, and runs benchmarks on a target device running iOS
7 or macOS (simulator or physical devices).
8
9# Usage
10
11A KMP project needs to do something like:
12
13```groovy
14plugins {
15 id("androidx.benchmark.darwin")
16}
17```
18
19and then it can use the `darwinBenchmark` block like so:
20
21```groovy
22darwinBenchmark {
23 // XCodegen Schema YAML
24 xcodeGenConfigFile = project.rootProject.file(
25 "benchmark/benchmark-darwin-samples-xcode/xcodegen-project.yml"
26 )
27 // XCode project name
28 xcodeProjectName = "benchmark-darwin-samples-xcode"
29 // iOS app scheme
30 scheme = "testapp-ios"
31
32 // Destination
33 destination = "platform=iOS Simulator,name=iPhone 13,OS=15.2"
34 // Or a target device id
35 destination = "id=7F61C467-4E4A-437C-B6EF-026FEEF3904C"
36
37 // The XCFrameworkConfig name
38 xcFrameworkConfig = "AndroidXDarwinSampleBenchmarks"
39}
40```
41
42Example metrics look like:
43
44```json
45{
46 "key": {
47 "testDescription": "Allocate an ArrayList of size 1000",
48 "metricName": "Memory Peak Physical",
49 "metricIdentifier": "com.apple.dt.XCTMetric_Memory.physical_peak",
50 "polarity": "prefers smaller",
51 "units": "kB"
52 },
53 "measurements": {
54 "stat": [
55 {
56 "value": "min",
57 "measurement": 0.0
58 },
59 {
60 "value": "median",
61 "measurement": 0.0
62 },
63 {
64 "value": "max",
65 "measurement": 0.0
66 },
67 {
68 "value": "stddev",
69 "measurement": 0.0
70 }
71 ]
72 }
73}
74```
75