hannoy 0.1.3

HNSW Approximate Nearest Neighbors in Rust, based on LMDB and optimized for memory usage
Documentation
name: CodSpeed

on:
  push:
    branches:
      - "main"
  pull_request:  # run on PRs
    branches:
      - "main"
  workflow_dispatch: # manual trigger

jobs:
  benchmarks:
    name: Run benchmarks
    runs-on: ubuntu-latest
    # ✅ Run if:
    # - workflow_dispatch
    # - PR has 'benchmarks' label
    # - push to main (merge)
    if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'benchmarks')) || github.event_name == 'push' }}
    steps:
      - uses: actions/checkout@v4

      - name: Setup rust toolchain, cache and cargo-codspeed binary
        uses: moonrepo/setup-rust@v0
        with:
          channel: stable
          cache-target: release
          bins: cargo-codspeed

      - name: Build the benchmark target(s)
        run: cargo codspeed build

      - name: Run the benchmarks
        uses: CodSpeedHQ/action@v3
        env:
          HANNOY_READER_PREFETCH_MEMORY: 1048576 # 1MiB
        with:
          run: cargo codspeed run --bench benchmark
          token: ${{ secrets.CODSPEED_TOKEN }}