diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml new file mode 100644 index 0000000..52f65ca --- /dev/null +++ b/.github/workflows/bench.yml @@ -0,0 +1,53 @@ +# Run performance benchmarks +name: Benchmarks + +on: + push: + branches: ["main"] + release: + types: [published] + pull_request: + types: [opened, reopened, synchronize] + branches: ["main"] + +env: + CARGO_TERM_COLOR: always + +permissions: + contents: read + +jobs: + rust: + runs-on: ubuntu-24.04 + strategy: + matrix: + toolchain: + - 1.85.0 # msrv + - stable + steps: + - name: Checkout repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Install apt packages + run: | + sudo apt update + sudo apt install -y --no-install-recommends libgdal-dev + + - name: Setup rust toolchain, cache and cargo-codspeed binary + uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2 + with: + channel: ${{ matrix.toolchain }} + cache: false + cache-target: release + bins: cargo-codspeed + + - name: Build the benchmark target(s) + run: cargo codspeed build + + - name: Run the benchmarks + uses: CodSpeedHQ/action@bb005fe1c1eea036d3894f02c049cb6b154a1c27 # v4.3.3 + with: + mode: instrumentation + run: cargo codspeed run diff --git a/Cargo.toml b/Cargo.toml index 3459739..bef3579 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,5 +31,5 @@ url = "2.5.7" cuda = ["cudarc"] [[bench]] -name = "read_cog" +name = "read_geotiff" harness = false diff --git a/benches/read_geotiff.rs b/benches/read_geotiff.rs new file mode 100644 index 0000000..00874f6 --- /dev/null +++ b/benches/read_geotiff.rs @@ -0,0 +1,10 @@ +use criterion::{Criterion, criterion_group, criterion_main}; + +fn criterion_benchmark(c: &mut Criterion) { + let mut group = c.benchmark_group("read_geotiff"); + + group.finish(); +} + +criterion_group!(benches, criterion_benchmark); +criterion_main!(benches);