Skip to content

Commit d61cc56

Browse files
authored
Add benchmarks (#93)
1 parent e551435 commit d61cc56

File tree

5 files changed

+235
-168
lines changed

5 files changed

+235
-168
lines changed

.github/workflows/rust.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
- name: test
3737
if: ${{ matrix.rust != '1.67.1' }}
3838
run: cargo test -v && cargo doc -v
39+
- name: bench
40+
if: ${{ matrix.rust == 'nightly' }}
41+
run: cargo bench -v --features _benchmarks
3942

4043
test_big_endian:
4144
# github actions does not support big endian systems directly, but it does support QEMU.
@@ -67,23 +70,11 @@ jobs:
6770
clippy:
6871
runs-on: ubuntu-latest
6972
steps:
70-
- name: install-dependencies
71-
run: sudo apt update && sudo apt install ninja-build meson nasm
7273
- uses: actions/checkout@v4
7374
- uses: dtolnay/rust-toolchain@stable
7475
with:
7576
components: clippy
7677
- run: cargo clippy --all-features -- -D warnings
77-
env:
78-
SYSTEM_DEPS_DAV1D_BUILD_INTERNAL: always
79-
80-
build_benchmarks:
81-
runs-on: ubuntu-latest
82-
steps:
83-
- uses: actions/checkout@v4
84-
- uses: dtolnay/rust-toolchain@nightly
85-
- name: build
86-
run: cargo build -v --benches
8778

8879
rustfmt:
8980
runs-on: ubuntu-latest

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ paste = "1.0.14"
2121
png = "0.17.12"
2222
rand = "0.8.5"
2323
webp = "0.3.0"
24+
25+
[features]
26+
_benchmarks = []

src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#![deny(missing_docs)]
55
// Increase recursion limit for the `quick_error!` macro.
66
#![recursion_limit = "256"]
7+
// Enable nightly benchmark functionality if "_benchmarks" feature is enabled.
8+
#![cfg_attr(all(test, feature = "_benchmarks"), feature(test))]
9+
#[cfg(all(test, feature = "_benchmarks"))]
10+
extern crate test;
711

812
pub use self::decoder::{DecodingError, LoopCount, WebPDecoder};
913
pub use self::encoder::{ColorType, EncodingError, WebPEncoder};

0 commit comments

Comments
 (0)