Unverified Commit 6e80e56b authored by Donny/강동윤's avatar Donny/강동윤 Committed by GitHub

chore(ci): Configure automated benchmark for turbopack (#79791)

### What?

This PR configures an automated benchmark for turbopack. We can run small benchmarks for all turbopack PRs, and I'll add more benchmarks with follow-up PRs.


### Why?

We need a way to track performance consistently.
parent 2b7a2591
name: Benchmark name: Turbopack Benchmark
on: on:
workflow_dispatch:
push: push:
branches: branches:
- canary - canary
paths: paths:
- '**/crates/**' - '**/crates/**'
- '**/Cargo.toml'
- '**/Cargo.lock'
pull_request: pull_request:
types: ['labeled'] types: ['opened', 'reopened', 'synchronize']
paths:
- '**/crates/**'
- '**/Cargo.toml'
- '**/Cargo.lock'
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.sha }} group: ${{ github.workflow }}-${{ github.sha }}
...@@ -20,48 +27,22 @@ env: ...@@ -20,48 +27,22 @@ env:
RUST_LOG: 'off' RUST_LOG: 'off'
jobs: jobs:
list-crates: benchmark-small:
name: List crates to benchmark name: Benchmark Rust Crates (small)
runs-on:
- 'self-hosted'
- 'linux'
- 'x64'
- 'metal'
if: ${{ github.event.label.name == 'benchmark' }}
outputs:
crates: ${{ steps.list-crates.outputs.crates }}
steps:
- uses: actions/checkout@v4
- name: List crates
id: list-crates
run: echo "crates=$(./scripts/cargo/bench/list-crates-with-bench.sh)" >> $GITHUB_OUTPUT
benchmark-crate:
name: Benchmark ${{ matrix.crate }}
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
needs: list-crates
# Limit the number of concurrent jobs to 1
concurrency:
group: ${{ github.workflow }}
strategy:
matrix:
crate: ${{fromJson(needs.list-crates.outputs.crates)}}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Rust - name: Setup Rust toolchain
uses: actions-rs/toolchain@v1 uses: ./.github/actions/setup-rust
with:
profile: minimal
- name: Install cargo-codspeed - name: Install cargo-codspeed
uses: taiki-e/install-action@v2 uses: taiki-e/install-action@v2
with: with:
tool: cargo-codspeed@2.8.1 tool: cargo-codspeed@2.10.1
- name: Build the benchmark target(s) - name: Build the benchmark target(s)
run: cargo codspeed build -p ${{ matrix.crate }} run: cargo codspeed build -p turbo-rcstr -p turbopack-ecmascript
- name: Run the benchmarks - name: Run the benchmarks
uses: CodSpeedHQ/action@v3 uses: CodSpeedHQ/action@v3
......
...@@ -1313,6 +1313,61 @@ version = "0.2.3" ...@@ -1313,6 +1313,61 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15"
[[package]]
name = "codspeed"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f4cce9c27c49c4f101fffeebb1826f41a9df2e7498b7cd4d95c0658b796c6c"
dependencies = [
"colored",
"libc",
"serde",
"serde_json",
"uuid",
]
[[package]]
name = "codspeed-criterion-compat"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c23d880a28a2aab52d38ca8481dd7a3187157d0a952196b6db1db3c8499725"
dependencies = [
"codspeed",
"codspeed-criterion-compat-walltime",
"colored",
"futures",
"tokio",
]
[[package]]
name = "codspeed-criterion-compat-walltime"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0a2f7365e347f4f22a67e9ea689bf7bc89900a354e22e26cf8a531a42c8fbb"
dependencies = [
"anes",
"cast",
"ciborium",
"clap",
"codspeed",
"criterion-plot",
"futures",
"is-terminal",
"itertools 0.10.5",
"num-traits",
"once_cell",
"oorandom",
"plotters",
"rayon",
"regex",
"serde",
"serde_derive",
"serde_json",
"tinytemplate",
"tokio",
"walkdir",
]
[[package]] [[package]]
name = "color_quant" name = "color_quant"
version = "1.1.0" version = "1.1.0"
...@@ -1325,6 +1380,16 @@ version = "1.0.0" ...@@ -1325,6 +1380,16 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "colored"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
"windows-sys 0.59.0",
]
[[package]] [[package]]
name = "combine" name = "combine"
version = "4.6.7" version = "4.6.7"
...@@ -1615,34 +1680,6 @@ dependencies = [ ...@@ -1615,34 +1680,6 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "criterion"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f"
dependencies = [
"anes",
"cast",
"ciborium",
"clap",
"criterion-plot",
"futures",
"is-terminal",
"itertools 0.10.5",
"num-traits",
"once_cell",
"oorandom",
"plotters",
"rayon",
"regex",
"serde",
"serde_derive",
"serde_json",
"tinytemplate",
"tokio",
"walkdir",
]
[[package]] [[package]]
name = "criterion-plot" name = "criterion-plot"
version = "0.5.0" version = "0.5.0"
...@@ -2996,7 +3033,7 @@ dependencies = [ ...@@ -2996,7 +3033,7 @@ dependencies = [
"httpdate", "httpdate",
"itoa", "itoa",
"pin-project-lite", "pin-project-lite",
"socket2 0.4.9", "socket2 0.5.8",
"tokio", "tokio",
"tower-service", "tower-service",
"tracing", "tracing",
...@@ -9520,7 +9557,7 @@ version = "0.1.0" ...@@ -9520,7 +9557,7 @@ version = "0.1.0"
name = "turbo-rcstr" name = "turbo-rcstr"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"criterion", "codspeed-criterion-compat",
"new_debug_unreachable", "new_debug_unreachable",
"serde", "serde",
"shrink-to-fit", "shrink-to-fit",
...@@ -9599,7 +9636,7 @@ dependencies = [ ...@@ -9599,7 +9636,7 @@ dependencies = [
"auto-hash-map", "auto-hash-map",
"bitfield", "bitfield",
"byteorder", "byteorder",
"criterion", "codspeed-criterion-compat",
"dashmap 6.1.0", "dashmap 6.1.0",
"either", "either",
"hashbrown 0.14.5", "hashbrown 0.14.5",
...@@ -9697,8 +9734,8 @@ dependencies = [ ...@@ -9697,8 +9734,8 @@ dependencies = [
"auto-hash-map", "auto-hash-map",
"bitflags 1.3.2", "bitflags 1.3.2",
"bytes", "bytes",
"codspeed-criterion-compat",
"concurrent-queue", "concurrent-queue",
"criterion",
"dashmap 6.1.0", "dashmap 6.1.0",
"dunce", "dunce",
"futures", "futures",
...@@ -9819,7 +9856,7 @@ name = "turbopack" ...@@ -9819,7 +9856,7 @@ name = "turbopack"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"criterion", "codspeed-criterion-compat",
"difference", "difference",
"futures", "futures",
"indexmap 2.7.1", "indexmap 2.7.1",
...@@ -9860,7 +9897,7 @@ version = "0.1.0" ...@@ -9860,7 +9897,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chromiumoxide", "chromiumoxide",
"criterion", "codspeed-criterion-compat",
"futures", "futures",
"nix 0.26.4", "nix 0.26.4",
"once_cell", "once_cell",
...@@ -9911,8 +9948,8 @@ version = "0.1.0" ...@@ -9911,8 +9948,8 @@ version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap", "clap",
"codspeed-criterion-compat",
"console-subscriber", "console-subscriber",
"criterion",
"dunce", "dunce",
"futures", "futures",
"mime", "mime",
...@@ -10089,7 +10126,7 @@ version = "0.1.0" ...@@ -10089,7 +10126,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
"criterion", "codspeed-criterion-compat",
"data-encoding", "data-encoding",
"either", "either",
"indexmap 2.7.1", "indexmap 2.7.1",
...@@ -10670,9 +10707,14 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" ...@@ -10670,9 +10707,14 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.5.0" version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
dependencies = [
"getrandom 0.3.2",
"js-sys",
"wasm-bindgen",
]
[[package]] [[package]]
name = "v_frame" name = "v_frame"
......
...@@ -340,7 +340,7 @@ concurrent-queue = "2.5.0" ...@@ -340,7 +340,7 @@ concurrent-queue = "2.5.0"
console = "0.15.5" console = "0.15.5"
console-subscriber = "0.4.1" console-subscriber = "0.4.1"
const_format = "0.2.30" const_format = "0.2.30"
criterion = "0.5.1" criterion = { package = "codspeed-criterion-compat", version = "2.10.1" }
crossbeam-channel = "0.5.8" crossbeam-channel = "0.5.8"
dashmap = "6.1.0" dashmap = "6.1.0"
data-encoding = "2.3.3" data-encoding = "2.3.3"
......
...@@ -19,5 +19,5 @@ proc-macro2 = { workspace = true } ...@@ -19,5 +19,5 @@ proc-macro2 = { workspace = true }
quote = { workspace = true } quote = { workspace = true }
regex = { workspace = true } regex = { workspace = true }
rustc-hash = { workspace = true } rustc-hash = { workspace = true }
syn = { workspace = true, features = ["full", "extra-traits", "visit-mut"] } syn = { workspace = true, features = ["full", "extra-traits", "visit", "visit-mut"] }
turbo-tasks-macros-shared = { workspace = true } turbo-tasks-macros-shared = { workspace = true }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment