From c671494ff0df95b58388e89d03d6ca2849485938 Mon Sep 17 00:00:00 2001 From: Marvin Vogt Date: Tue, 28 Nov 2023 20:59:36 +0100 Subject: [PATCH 1/4] Add CI benchmarks using codspeed (#44) * Add codspeed dependency and use criterion drop in * Use codspeed in benchmark workflow * Add codspeed badge --- .github/workflows/benchmark.yml | 29 +++++++++++++++-------------- Cargo.toml | 1 + README.md | 3 +++ benches/parse_as3257.rs | 2 +- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index afed788..86e37b3 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -5,25 +5,26 @@ on: push: branches: [main] pull_request: - branches: [main] workflow_dispatch: -concurrency: - group: >- - ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number - || github.sha }} - cancel-in-progress: true - env: COLUMNS: 120 - HYPERFINE_VERSION: "1.17.0" jobs: - cargo-bench: - runs-on: ubuntu-22.04 + benchmarks: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@v2 - - name: run benchmark - run: cargo bench + - 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@v1 + with: + run: cargo codspeed run + token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index d085e8e..a438310 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ nom = "7.1.3" pyo3 = { version = "0.20.0", optional = true } [dev-dependencies] +codspeed-criterion-compat = "2.3.3" criterion = { version = "0.5.1", features = ["html_reports"] } [[bench]] diff --git a/README.md b/README.md index 7326624..0e6c445 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ CI status + + CodSpeed Badge + Cargo version diff --git a/benches/parse_as3257.rs b/benches/parse_as3257.rs index 6579485..abeda2a 100644 --- a/benches/parse_as3257.rs +++ b/benches/parse_as3257.rs @@ -1,4 +1,4 @@ -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Criterion}; pub fn criterion_benchmark(c: &mut Criterion) { c.bench_function("parse AS3257", |b| { From 330bfcf6b1e057d21bced575e014dc561d55c775 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Dec 2023 09:03:32 +0100 Subject: [PATCH 2/4] Bump CodSpeedHQ/action from 1 to 2 (#45) --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 86e37b3..d326f82 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -24,7 +24,7 @@ jobs: - name: Build the benchmark target(s) run: cargo codspeed build - name: Run the benchmarks - uses: CodSpeedHQ/action@v1 + uses: CodSpeedHQ/action@v2 with: run: cargo codspeed run token: ${{ secrets.CODSPEED_TOKEN }} From 122a1bf921d924ca7c46de070e31b7965fb9fe96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 2 Dec 2023 09:04:25 +0100 Subject: [PATCH 3/4] Bump moonrepo/setup-rust from 0 to 1 (#46) --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d326f82..6db4824 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup rust toolchain, cache and cargo-codspeed binary - uses: moonrepo/setup-rust@v0 + uses: moonrepo/setup-rust@v1 with: channel: stable cache-target: release From ca0652df665297e4e4e7081e4b57cb5fcfd01117 Mon Sep 17 00:00:00 2001 From: Marvin Vogt Date: Sat, 9 Dec 2023 22:05:36 +0100 Subject: [PATCH 4/4] Add links to rust docs and benchmarks to README (#47) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0e6c445..36d0598 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ An [RFC 2622] conformant Routing Policy Specification Language (RPSL) parser wit > [!WARNING] > This project is still in early stages of development and its API is not yet stable. +[**Docs**](https://docs.rs/rpsl-parser/latest/rpsl_parser/) | [**Performance**](https://github.com/SRv6d/rpsl-parser/tree/main/docs/benchmark) + ## Examples ### Parsing RPSL