-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add benches for TheAlgorithms/audio_filters
- Loading branch information
Showing
9 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "tests/benchmarks/TheAlgorithms"] | ||
path = tests/benchmarks/TheAlgorithms | ||
url = [email protected]:TheAlgorithms/Python.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule TheAlgorithms
added at
77bbe5
Empty file.
Empty file.
37 changes: 37 additions & 0 deletions
37
tests/benchmarks/TheAlgorithms_bench/audio_filters/test_bench_butterworth_filter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from audio_filters.butterworth_filter import ( | ||
make_allpass, | ||
make_bandpass, | ||
make_highpass, | ||
make_highshelf, | ||
make_lowpass, | ||
make_lowshelf, | ||
make_peak, | ||
) | ||
|
||
|
||
def test_make_lowpass(benchmark): | ||
benchmark(make_lowpass, 1000, 48000) | ||
|
||
|
||
def test_make_highpass(benchmark): | ||
benchmark(make_highpass, 1000, 48000) | ||
|
||
|
||
def test_make_bandpass(benchmark): | ||
benchmark(make_bandpass, 1000, 48000) | ||
|
||
|
||
def test_make_allpass(benchmark): | ||
benchmark(make_allpass, 1000, 48000) | ||
|
||
|
||
def test_make_peak(benchmark): | ||
benchmark(make_peak, 1000, 48000, 6) | ||
|
||
|
||
def test_make_lowshelf(benchmark): | ||
benchmark(make_lowshelf, 1000, 48000, 6) | ||
|
||
|
||
def test_make_highshelf(benchmark): | ||
benchmark(make_highshelf, 1000, 48000, 6) |
13 changes: 13 additions & 0 deletions
13
tests/benchmarks/TheAlgorithms_bench/audio_filters/test_bench_iir_filter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from audio_filters.iir_filter import IIRFilter | ||
|
||
|
||
def test_set_coefficients(benchmark): | ||
filt = IIRFilter(2) | ||
a_coeffs = [1.0, -1.8, 0.81] | ||
b_coeffs = [0.9, -1.8, 0.81] | ||
benchmark(filt.set_coefficients, a_coeffs, b_coeffs) | ||
|
||
|
||
def test_process(benchmark): | ||
filt = IIRFilter(2) | ||
benchmark(filt.process, 0) |
Empty file.