Skip to content

Commit 75c9c53

Browse files
committed
Add benchmarks to CI for resampler
1 parent 734c595 commit 75c9c53

File tree

4 files changed

+33
-23
lines changed

4 files changed

+33
-23
lines changed

.github/workflows/speexdsp.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ jobs:
4747
token: ${{ secrets.GITHUB_TOKEN }}
4848
args: --all --all-targets --all-features --tests -- --verbose
4949

50-
build:
50+
tests:
51+
52+
strategy:
53+
matrix:
54+
conf:
55+
- tests
56+
- bench-resampler
57+
- bench-resampler-sse
5158

5259
env:
5360
SPEEX_DIR: speex-dir
@@ -62,18 +69,32 @@ jobs:
6269
git clone https://github.com/xiph/speexdsp.git
6370
cd speexdsp
6471
./autogen.sh
65-
./configure --prefix=$HOME/$SPEEX_DIR
72+
CONF=${{ matrix.conf }}
73+
if [ ${CONF} = "bench-resampler" ]
74+
then
75+
./configure --disable-sse --prefix=$HOME/$SPEEX_DIR
76+
else
77+
./configure --prefix=$HOME/$SPEEX_DIR
78+
fi
6679
make -j4 install
6780
6881
- name: Set environment variables
6982
run: |
7083
echo "::set-env name=PKG_CONFIG_PATH::$HOME/$SPEEX_DIR/lib/pkgconfig"
7184
echo "::set-env name=LD_LIBRARY_PATH::$HOME/$SPEEX_DIR/lib"
7285
86+
- name: Run benchmark
87+
if: matrix.conf != 'tests'
88+
run: |
89+
cargo bench -q --features sys -- resampler_c
90+
cargo bench -q -- resampler_rust
91+
7392
- name: Run no-default-features tests
93+
if: matrix.conf == 'tests'
7494
run: |
7595
cargo test --all --no-default-features
7696
7797
- name: Run all-features tests
98+
if: matrix.conf == 'tests'
7899
run: |
79100
cargo test --all --all-features

benches/comparison.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

benches/resampling_c.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,9 @@ pub fn criterion_benchmark(c: &mut Criterion) {
6868
c.bench_function("resampler_c", |b| b.iter(|| resample_c()));
6969
}
7070

71-
criterion_group!(benches, criterion_benchmark);
71+
criterion_group! {
72+
name = benches;
73+
config = Criterion::default().sample_size(10);
74+
targets = criterion_benchmark
75+
}
7276
criterion_main!(benches);

benches/resampling_rust.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,9 @@ pub fn criterion_benchmark(c: &mut Criterion) {
5454
c.bench_function("resampler_rust", |b| b.iter(|| resample_rs()));
5555
}
5656

57-
criterion_group!(benches, criterion_benchmark);
57+
criterion_group! {
58+
name = benches;
59+
config = Criterion::default().sample_size(10);
60+
targets = criterion_benchmark
61+
}
5862
criterion_main!(benches);

0 commit comments

Comments
 (0)