cheetah-string 3.2.0

An immutable, clone-cheap UTF-8 string with explicit construction and byte interoperability
Documentation
name: Performance contracts

on:
  pull_request:
    branches: [main]
  workflow_dispatch:
  schedule:
    - cron: "41 5 * * 2"

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  deterministic-contracts:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

      - name: Set up stable Rust
        uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
        with:
          toolchain: stable

      - name: Verify allocation contracts
        run: cargo test --test allocation_contract --all-features -- --test-threads=1

      - name: Verify layout contracts
        run: cargo test --test layout_snapshot --all-features -- --nocapture

      - name: Capture shared-backing evidence
        shell: bash
        run: |
          cargo bench --bench shared_backing -- __allocation_evidence_only__ --noplot 2>&1 |
            tee target/allocation-evidence.log

      - name: Verify shared-backing evidence
        run: python scripts/verify-allocation-evidence.py target/allocation-evidence.log

      - name: Upload allocation evidence
        if: always()
        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
        with:
          name: allocation-evidence
          path: target/allocation-evidence.log
          if-no-files-found: error
          retention-days: 14

  instruction-counts:
    # Compares exact per-iteration instruction counts of fixed scenarios
    # between the pull request and its base. To accept a deliberate
    # regression, label the pull request `accept-instruction-regression` and
    # re-run this job; it then reports the counts without failing.
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: read
    steps:
      - name: Checkout pull request
        uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
        with:
          path: head

      - name: Checkout base
        uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
        with:
          ref: ${{ github.event.pull_request.base.sha }}
          path: base

      - name: Set up stable Rust
        uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
        with:
          toolchain: stable

      - name: Install Valgrind
        run: sudo apt-get update && sudo apt-get install -y --no-install-recommends valgrind

      - name: Compare instruction counts
        shell: bash
        env:
          GH_TOKEN: ${{ github.token }}
          PR_NUMBER: ${{ github.event.pull_request.number }}
        run: |
          # Read the labels now: a re-run reuses the original event payload,
          # whose label list predates any label added since.
          labels=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json labels --jq '.labels[].name')
          args=()
          if grep -qx 'accept-instruction-regression' <<< "$labels"; then
            args+=(--report-only)
          fi
          python head/scripts/instruction-counts.py --base base --head head --summary "$GITHUB_STEP_SUMMARY" "${args[@]}"