feat(benchmark): rename benchmark tasks (#140)

This commit is contained in:
Khải
2023-10-09 21:36:18 +07:00
committed by GitHub
parent 2ddd6cf8d3
commit e025672594
16 changed files with 56 additions and 54 deletions

View File

@@ -3,5 +3,3 @@
ck = "check --workspace --all-targets --all-features --locked"
lint = "clippy --workspace --all-targets --all-features"
codecov = "llvm-cov nextest --workspace --ignore-filename-regex tasks"
benchmark = "run -p pacquet_benchmark --release --"
benchmark-install-against-revisions = "run --bin=benchmark-install-against-revisions --"

View File

@@ -1,4 +1,4 @@
name: Benchmark
name: Micro-Benchmark
on:
workflow_dispatch:
@@ -29,17 +29,17 @@ jobs:
- name: Install Rust Toolchain
uses: ./.github/actions/rustup
with:
shared-key: benchmark
shared-key: micro-benchmark
- name: Compile
run: cargo build --release -p pacquet_benchmark
run: cargo build --release -p pacquet_micro_benchmark
- name: Sleep for CPU cooldown
shell: bash
run: sleep 15s
- name: Run Bench on Main Branch
run: cargo benchmark --save-baseline main
run: cargo micro-benchmark --save-baseline main
- name: Checkout PR Branch
uses: actions/checkout@v4
@@ -48,14 +48,14 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: Compile
run: cargo build --release -p pacquet_benchmark
run: cargo build --release -p pacquet_micro_benchmark
- name: Sleep for CPU cooldown
shell: bash
run: sleep 15s
- name: Run Bench on PR Branch
run: cargo benchmark --save-baseline pr
run: cargo micro-benchmark --save-baseline pr
- name: Upload benchmark results
uses: actions/upload-artifact@v3
@@ -84,7 +84,7 @@ jobs:
- name: Linux | Compare benchmark results
shell: bash
run: |
echo "## Benchmark Results" >> summary.md
echo "## Micro-Benchmark Results" >> summary.md
echo "### Linux" >> summary.md
echo "\`\`\`" >> summary.md
critcmp main pr >> summary.md
@@ -102,7 +102,7 @@ jobs:
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Benchmark Results
body-includes: Micro-Benchmark Results
- name: Create or update comment
# Check if the event is not triggered by a fork
@@ -112,4 +112,4 @@ jobs:
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
comment-id: ${{ steps.fc.outputs.comment-id }}
body-file: summary.md
body-file: summary.md

60
pacquet/Cargo.lock generated
View File

@@ -1245,36 +1245,6 @@ version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "pacquet_benchmark"
version = "0.0.0"
dependencies = [
"clap",
"criterion",
"mockito",
"node-semver",
"pacquet_registry",
"pacquet_tarball",
"pipe-trait",
"project-root",
"reqwest",
"tempfile",
"tokio",
]
[[package]]
name = "pacquet_benchmark_install_against_revisions"
version = "0.0.0"
dependencies = [
"clap",
"itertools 0.11.0",
"os_display",
"pipe-trait",
"reqwest",
"tokio",
"which",
]
[[package]]
name = "pacquet_cafs"
version = "0.0.1"
@@ -1333,6 +1303,19 @@ dependencies = [
"pacquet_diagnostics",
]
[[package]]
name = "pacquet_integrated_benchmark"
version = "0.0.0"
dependencies = [
"clap",
"itertools 0.11.0",
"os_display",
"pipe-trait",
"reqwest",
"tokio",
"which",
]
[[package]]
name = "pacquet_lockfile"
version = "0.0.1"
@@ -1349,6 +1332,23 @@ dependencies = [
"text-block-macros",
]
[[package]]
name = "pacquet_micro_benchmark"
version = "0.0.0"
dependencies = [
"clap",
"criterion",
"mockito",
"node-semver",
"pacquet_registry",
"pacquet_tarball",
"pipe-trait",
"project-root",
"reqwest",
"tempfile",
"tokio",
]
[[package]]
name = "pacquet_npmrc"
version = "0.0.1"

View File

@@ -32,29 +32,29 @@ First, you to start a local registry server, such as [verdaccio](https://verdacc
verdaccio
```
Then, you can use the script named `benchmark-install-against-revisions` to run the various benchmark, For example:
Then, you can use the script named `integrated-benchmark` to run the various benchmark, For example:
```sh
# Comparing the branch you're working on against main
cargo benchmark-install-against-revisions --scenario=frozen-lockfile my-branch main
just integrated-benchmark --scenario=frozen-lockfile my-branch main
```
```sh
# Comparing current commit against the previous commit
cargo benchmark-install-against-revisions --scenario=frozen-lockfile HEAD HEAD~
just integrated-benchmark --scenario=frozen-lockfile HEAD HEAD~
```
```sh
# Comparing pacquet of current commit against pnpm
cargo benchmark-install-against-revisions --scenario=frozen-lockfile --with-pnpm HEAD
just integrated-benchmark --scenario=frozen-lockfile --with-pnpm HEAD
```
```sh
# Comparing pacquet of current commit, pacquet of main, and pnpm against each other
cargo benchmark-install-against-revisions --scenario=frozen-lockfile --with-pnpm HEAD main
just integrated-benchmark --scenario=frozen-lockfile --with-pnpm HEAD main
```
```sh
# See more options
cargo benchmark-install-against-revisions --help
just integrated-benchmark --help
```

View File

@@ -56,11 +56,11 @@ codecov:
cargo codecov --html
# Run the benchmarks. See `tasks/benchmark`
bench:
cargo benchmark
micro-benchmark:
cargo run --bin=micro-benchmark --release
benchmark-install-against-revisions +args:
cargo run --bin=benchmark-install-against-revisions -- {{args}}
integrated-benchmark +args:
cargo run --bin=integrated-benchmark -- {{args}}
cli +args:
cargo run --bin pacquet -- {{args}}

View File

@@ -1,5 +1,5 @@
[package]
name = "pacquet_benchmark_install_against_revisions"
name = "pacquet_integrated_benchmark"
version = "0.0.0"
publish = false
authors.workspace = true
@@ -11,7 +11,7 @@ license.workspace = true
repository.workspace = true
[[bin]]
name = "benchmark-install-against-revisions"
name = "integrated-benchmark"
path = "src/main.rs"
[dependencies]

View File

@@ -1,5 +1,5 @@
[package]
name = "pacquet_benchmark"
name = "pacquet_micro_benchmark"
version = "0.0.0"
publish = false
authors.workspace = true
@@ -10,6 +10,10 @@ keywords.workspace = true
license.workspace = true
repository.workspace = true
[[bin]]
name = "micro-benchmark"
path = "src/main.rs"
[dependencies]
pacquet_registry = { workspace = true }
pacquet_tarball = { workspace = true }