tree: 5142b22035586f885e9065b2aa783b5b9891470d [path history] [tgz]
  1. src/
  2. build.gradle
  3. lint-baseline.xml
  4. README.md
benchmark/benchmark-darwin-gradle-plugin/README.md

Introduction

A Gradle Plugin to build and generate benchmarking results for KMP iOS benchmarks.

  • Generates Skia Dashboard compatible results.
  • Automatically generates the XCode project, and runs benchmarks on a target device running iOS or macOS (simulator or physical devices).

Usage

A KMP project needs to do something like:

plugins {
    id("androidx.benchmark.darwin")
}

and then it can use the darwinBenchmark block like so:

darwinBenchmark {
    // XCodegen Schema YAML
    xcodeGenConfigFile = project.rootProject.file(
            "benchmark/benchmark-darwin-samples-xcode/xcodegen-project.yml"
    )
    // XCode project name
    xcodeProjectName = "benchmark-darwin-samples-xcode"
    // iOS app scheme
    scheme = "testapp-ios"

    // Destination
    destination = "platform=iOS Simulator,name=iPhone 13,OS=15.2"
    // Or a target device id
    destination = "id=7F61C467-4E4A-437C-B6EF-026FEEF3904C"

    // The XCFrameworkConfig name
    xcFrameworkConfig = "AndroidXDarwinSampleBenchmarks"
}

Example metrics look like:

{
  "key": {
    "testDescription": "Allocate an ArrayList of size 1000",
    "metricName": "Memory Peak Physical",
    "metricIdentifier": "com.apple.dt.XCTMetric_Memory.physical_peak",
    "polarity": "prefers smaller",
    "units": "kB"
  },
  "measurements": {
    "stat": [
      {
        "value": "min",
        "measurement": 0.0
      },
      {
        "value": "median",
        "measurement": 0.0
      },
      {
        "value": "max",
        "measurement": 0.0
      },
      {
        "value": "stddev",
        "measurement": 0.0
      }
    ]
  }
}