mobench
Command-line tool for building, running, reporting, and profiling Rust mobile benchmarks on Android and iOS.
Current release: 0.1.43.
Install
Or build with Cargo:
The package installs both direct and Cargo-subcommand entry points:
Quick Start
# Scaffold a config
# Validate local prerequisites and config
# Build mobile artifacts
# List and verify discovered benchmarks
# Host-only smoke run
# BrowserStack run
Always use --release for BrowserStack runs unless you are intentionally
debugging large development artifacts.
Core Commands
| Command | Purpose |
|---|---|
init |
Scaffold a base config file. |
init-sdk |
Initialize a benchmark project from SDK templates. |
doctor |
Validate local and CI prerequisites/configuration. |
config validate |
Validate config files and referenced matrix/settings. |
check |
Check Android or iOS build prerequisites. |
build |
Build Android/iOS mobile artifacts. |
run |
Run benchmarks locally, host-only, or on BrowserStack. |
ci run |
Run the full CI benchmark flow and write stable contract outputs. |
ci merge-split-runs |
Merge one-sample CI summaries into standard CI outputs. |
devices |
List BrowserStack devices. |
devices resolve |
Resolve deterministic device sets from matrix/profile. |
fixture |
Manage reproducible CI fixtures. |
report |
Render summaries and GitHub PR comments/checks. |
fetch |
Fetch BrowserStack build artifacts. |
summary |
Display statistics for a benchmark result JSON file. |
profile |
Run, summarize, and diff local native profile captures. |
package-ipa |
Package iOS app as IPA. |
package-xcuitest |
Package XCUITest runner for BrowserStack. |
Configuration
mobench.toml controls project-level build settings:
[]
= "zk-mobile-bench"
= "zk_mobile_bench"
= "target/mobench"
= "uniffi" # default; also supports "native-c-abi" and "boltffi"
# FFI backend for generated mobile runners: "uniffi" (default), "native-c-abi", or "boltffi".
# Use "boltffi" for BoltFFI-generated bindings, or "native-c-abi" for direct C ABI calls.
# ffi_backend = "uniffi"
[]
= "com.example.bench"
= 24
= 34
[]
= "com.example.bench"
= "15.0"
[]
= "my_crate::my_benchmark"
= 100
= 10
ffi_backend = "native-c-abi" selects generated runners that call mobench's
direct JSON C ABI. Benchmark crates using that backend should export:
export_native_c_abi!;
ffi_backend = "boltffi" selects generated runners that call BoltFFI-generated
Kotlin/Swift bindings. Benchmark crates using that backend should export a JSON
entrypoint with #[boltffi::export].
bench-config.toml controls a run:
= "android"
= "my_crate::my_benchmark"
= 100
= 10
= "device-matrix.yaml"
= ["default"]
[]
= "${BROWSERSTACK_USERNAME}"
= "${BROWSERSTACK_ACCESS_KEY}"
= "my-project-benchmarks"
[]
= "target/mobench/ios/BenchRunner.ipa"
= "target/mobench/ios/BenchRunnerUITests.zip"
Resolution precedence is explicit CLI flags, explicit --config, discovered
mobench.toml, Cargo workspace metadata, git root, then legacy bench-mobile/.
CI Contract
Outputs default to target/mobench/ci/:
summary.jsonsummary.mdresults.csvplots/*.svgwhen plot rendering is enabled
Use report helpers to publish or re-render outputs:
Long or fragile CI lanes can run one measured sample per BrowserStack
invocation and merge sample-*/summary.json outputs back into the same
contract:
BrowserStack
Credentials are read from config, environment, or .env.local:
Useful device commands:
Local Native Profiling
Supported local backends:
local + android-native: attemptssimpleperfcapture, symbolization, folded stacks, native report, SVGs, andflamegraph.html.local + ios-instruments: attempts simulator-hostsamplecapture, folded stacks, native report, SVGs, andflamegraph.html.local + rust-tracing: planned trace contract only.
BrowserStack native profiling is unsupported in this release; use normal BrowserStack benchmark runs for timing, CPU, and memory metrics.
Programmatic CLI API
The crate exposes typed integration helpers:
RunRequestRunResultDeviceSelectionReportrun_requestrender_summary_markdown_from_jsonrender_profile_markdown_from_json
License
MIT licensed, World Foundation 2026.