From a7bd3888a9b40bab59edd54037c9940b91865412 Mon Sep 17 00:00:00 2001 From: Adrien Cacciaguerra Date: Wed, 1 May 2024 14:47:47 -0400 Subject: [PATCH] feat: add CodSpeed to the project --- .github/workflows/benchmark.yml | 31 ++++++++++++++++++++++++++++ Cargo.lock | 36 +++++++++++++++++++++++++++++++-- lapce-app/Cargo.toml | 2 +- 3 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..a440803ba7 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,31 @@ +name: codspeed-benchmarks + +on: + # Run on pushes to the main branch + push: + branches: + - "main" + # Run on pull requests + pull_request: + # `workflow_dispatch` allows CodSpeed to trigger backtest + # performance analysis in order to generate initial data. + workflow_dispatch: + +jobs: + benchmarks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup rust toolchain, cache and cargo-codspeed binary + uses: moonrepo/setup-rust@v1 + with: + cache-target: release + bins: cargo-codspeed + + - name: Build the benchmark target(s) + run: cargo codspeed build -p lapce-app + + - name: Run the benchmarks + uses: CodSpeedHQ/action@v2 + with: + run: cargo codspeed run -p lapce-app diff --git a/Cargo.lock b/Cargo.lock index a2792f548a..993a246f4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -866,12 +866,44 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "codspeed" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a104ac948e0188b921eb3fcbdd55dcf62e542df4c7ab7e660623f6288302089" +dependencies = [ + "colored", + "libc", + "serde_json", +] + +[[package]] +name = "codspeed-criterion-compat" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "722c36bdc62d9436d027256ce2627af81ac7a596dfc7d13d849d0d212448d7fe" +dependencies = [ + "codspeed", + "colored", + "criterion", +] + [[package]] name = "color_quant" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + [[package]] name = "com" version = "0.6.0" @@ -2962,8 +2994,8 @@ dependencies = [ "bytemuck", "chrono", "clap", + "codspeed-criterion-compat", "config", - "criterion", "crossbeam-channel", "directories", "dmg", @@ -3007,7 +3039,7 @@ dependencies = [ "tracing-subscriber", "unicode-width", "url", - "windows-sys 0.36.1", + "windows-sys 0.52.0", "zip", ] diff --git a/lapce-app/Cargo.toml b/lapce-app/Cargo.toml index 162b0c61bf..8e91b2e356 100644 --- a/lapce-app/Cargo.toml +++ b/lapce-app/Cargo.toml @@ -98,7 +98,7 @@ all-languages = [ ] [dev-dependencies] -criterion = "0.5" +criterion = { version = "2.6.0", package = "codspeed-criterion-compat" } [[bench]] name = "visual_line"