Skip to content

Commit d8d252d

Browse files
authored
chore(dev): adjust benchmark parameters (#229)
For increased accuracy/stability, the python binding is no longer run in the benchmark CI. It can still be run locally but would take an extra call (`install-py-binding`) to build the binding before running benchmark.nu (`main`).
1 parent 82913d6 commit d8d252d

File tree

2 files changed

+46
-37
lines changed

2 files changed

+46
-37
lines changed

.github/workflows/benchmark.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -68,37 +68,37 @@ jobs:
6868
name: ${{ matrix.name }}
6969
path: ${{ env.BIN }}
7070

71-
build-py-binding:
72-
runs-on: ubuntu-latest
73-
steps:
74-
- uses: actions/checkout@v6
75-
with:
76-
persist-credentials: false
77-
- name: Set up Python
78-
uses: actions/setup-python@v6
79-
id: setup-python
80-
with:
81-
python-version: '3.x'
82-
- name: Build wheels
83-
uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
84-
with:
85-
target: x86_64
86-
args: --release --out dist --find-interpreter
87-
manylinux: auto
88-
before-script-linux: |
89-
# NOTE: rust-cross/manylinux docker images are CentOS based
90-
yum update -y
91-
yum install -y openssl openssl-devel
92-
- name: Upload wheels
93-
uses: actions/upload-artifact@v5
94-
with:
95-
name: wheel
96-
path: dist/cpp_linter-*-cp3*-abi3-*.whl
97-
if-no-files-found: error
71+
# build-py-binding:
72+
# runs-on: ubuntu-latest
73+
# steps:
74+
# - uses: actions/checkout@v6
75+
# with:
76+
# persist-credentials: false
77+
# - name: Set up Python
78+
# uses: actions/setup-python@v6
79+
# id: setup-python
80+
# with:
81+
# python-version: '3.x'
82+
# - name: Build wheels
83+
# uses: PyO3/maturin-action@86b9d133d34bc1b40018696f782949dac11bd380 # v1.49.4
84+
# with:
85+
# target: x86_64
86+
# args: --release --out dist --find-interpreter
87+
# manylinux: auto
88+
# before-script-linux: |
89+
# # NOTE: rust-cross/manylinux docker images are CentOS based
90+
# yum update -y
91+
# yum install -y openssl openssl-devel
92+
# - name: Upload wheels
93+
# uses: actions/upload-artifact@v5
94+
# with:
95+
# name: wheel
96+
# path: dist/cpp_linter-*-cp3*-abi3-*.whl
97+
# if-no-files-found: error
9898

9999
benchmark:
100100
name: Measure Performance Difference
101-
needs: [build-bin, build-py-binding]
101+
needs: [build-bin] #, build-py-binding]
102102
runs-on: ubuntu-latest
103103
steps:
104104
- uses: actions/checkout@v6
@@ -132,11 +132,11 @@ jobs:
132132
working-directory: benchmark
133133
shell: nu {0}
134134
run: |-
135-
let new_py = (
136-
glob "../wheel/cpp_linter-*-cp3*-abi3-*.whl"
137-
| first
138-
| path expand
139-
)
135+
# let new_py = (
136+
# glob "../wheel/cpp_linter-*-cp3*-abi3-*.whl"
137+
# | first
138+
# | path expand
139+
# )
140140
let prev_bin = "../previous/cpp-linter" | path expand
141141
let curr_bin = "../current/cpp-linter" | path expand
142-
nu benchmark.nu --new-py $new_py --rust-bin $curr_bin --prev-rust-bin $prev_bin
142+
nu benchmark.nu --rust-bin $curr_bin --prev-rust-bin $prev_bin

benchmark/benchmark.nu

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,13 @@ export def run-hyperfine [
122122
--export-markdown ../benchmark.md
123123
--warmup 1
124124
--style color
125-
--runs 3
125+
--runs
126126
]
127+
if ($new_path | is-not-empty) {
128+
$hyperfine_args = $hyperfine_args | append 3
129+
} else {
130+
$hyperfine_args = $hyperfine_args | append 4
131+
}
127132
let common_args = "-l 0 -a 0 -i=|!src/libgit2 -p build -e c"
128133
if ($old_path | is-not-empty) {
129134
$hyperfine_args = $hyperfine_args | append [--command-name python-pure $"($old_path) ($common_args) -j 0"]
@@ -165,9 +170,9 @@ export def summarize [] {
165170
# 4. Clones the libgit2 repository if it does not exist.
166171
# 5. Runs benchmarks using hyperfine and saves the results to benchmark.json.
167172
export def main [
168-
--new-py: string, # path to wheel of new version of cpp-linter (v2.x)
169173
--rust-bin: string, # path to rust binary of cpp-linter (v2.x)
170174
--prev-rust-bin: string, # path to previous commit's release build of rust binary (v2.x)
175+
--new-py: string = "", # path to wheel of new version of cpp-linter (v2.x)
171176
] {
172177
let is_on_win = sys host | get name | str starts-with "Windows"
173178
let rust_bin = if ($rust_bin | is-not-empty) {
@@ -182,7 +187,11 @@ export def main [
182187
run-cmd chmod +x $prev_rust_bin
183188
}
184189
let old_path = install-old
185-
let new_path = install-py-binding $new_py
190+
let new_path = if ($new_py | is-not-empty) {
191+
install-py-binding $new_py
192+
} else {
193+
""
194+
}
186195
checkout-libgit2
187196
run-hyperfine $old_path $new_path $rust_bin $prev_rust_bin
188197
summarize

0 commit comments

Comments
 (0)