diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 5a04b0a..7df71d3 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -17,17 +17,12 @@ defaults: shell: bash jobs: - benchmark: - name: Benchmark - runs-on: ubuntu-latest + build: + name: Prepare + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v5 - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable - with: - targets: x86_64-unknown-linux-gnu - - uses: actions/setup-node@v5 with: node-version: 22 @@ -38,18 +33,43 @@ jobs: run: node download-fixtures.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload Fixtures + uses: actions/upload-artifact@v4 + with: + name: benchmark-fixtures + path: fixtures + - name: Upload rxjs + uses: actions/upload-artifact@v4 + with: + name: benchmark-rxjs + path: node_modules/rxjs + run: + runs-on: codspeed-macro + needs: build + steps: + - uses: actions/checkout@v5 + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable - uses: taiki-e/install-action@v2 with: tool: cargo-codspeed - - name: Build benchmark - run: cargo codspeed build --features codspeed - + run: cargo codspeed build --bench escape --features codspeed + - name: Download fixtures + uses: actions/download-artifact@v5 + with: + name: benchmark-fixtures + path: fixtures + - name: Download rxjs + uses: actions/download-artifact@v5 + with: + name: benchmark-rxjs + path: node_modules/rxjs - name: Run benchmark uses: CodSpeedHQ/action@v4 timeout-minutes: 15 with: - run: cargo codspeed run - mode: instrumentation + run: cargo codspeed run escape + mode: walltime token: ${{ secrets.CODSPEED_TOKEN }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 81ddd4d..df7f329 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.0.0](https://github.com/napi-rs/json-escape-simd/compare/json-escape-simd-v1.1.0...json-escape-simd-v2.0.0) - 2025-10-13 + +### Other + +- fix codspeed +- remove useless deps ([#28](https://github.com/napi-rs/json-escape-simd/pull/28)) +- update benchmark result +- borrow the sonic-rs string escape implementation ([#27](https://github.com/napi-rs/json-escape-simd/pull/27)) +- *(deps)* update rust crate json-escape to 0.3.0 ([#24](https://github.com/napi-rs/json-escape-simd/pull/24)) +- *(deps)* update rust crate json-escape to 0.2.0 ([#23](https://github.com/napi-rs/json-escape-simd/pull/23)) +- omit other crates in codspeed ([#22](https://github.com/napi-rs/json-escape-simd/pull/22)) +- add benchmark ([#20](https://github.com/napi-rs/json-escape-simd/pull/20)) + ## [1.1.0](https://github.com/napi-rs/json-escape-simd/compare/json-escape-simd-v1.0.4...json-escape-simd-v1.1.0) - 2025-09-23 ### Added diff --git a/Cargo.lock b/Cargo.lock index fb0b6d0..328b110 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -313,7 +313,7 @@ dependencies = [ [[package]] name = "json-escape-simd" -version = "1.1.0" +version = "2.0.0" dependencies = [ "criterion2", "glob", diff --git a/Cargo.toml b/Cargo.toml index cda204f..14a4cc0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["cpu-features"] [package] name = "json-escape-simd" -version = "1.1.0" +version = "2.0.0" edition = "2024" rust-version = "1.89.0" include = ["src/**/*.rs"] @@ -22,6 +22,7 @@ codspeed = ["criterion2/codspeed"] [[bench]] name = "escape" harness = false +path = "benches/escape.rs" [dependencies] sonic-simd = "0.1" diff --git a/benches/escape.rs b/benches/escape.rs index 02616b1..fe5b36a 100644 --- a/benches/escape.rs +++ b/benches/escape.rs @@ -2,9 +2,11 @@ use std::{fs, hint::black_box}; use criterion::{Criterion, criterion_group, criterion_main}; +#[cfg(not(feature = "codspeed"))] use generic::escape_generic; use json_escape_simd::escape; +#[cfg(not(feature = "codspeed"))] mod generic; fn get_rxjs_sources() -> Vec {