File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,21 @@ jobs:
103103 SCCACHE_GHA_ENABLED : " true"
104104 RUSTC_WRAPPER : " sccache"
105105 run : cargo test
106+ - name : Run benchmark
107+ if : matrix.os == 'ubuntu-latest'
108+ env :
109+ SCCACHE_GHA_ENABLED : " true"
110+ RUSTC_WRAPPER : " sccache"
111+ run : cargo bench -- --output-format bencher | tee bench.txt
112+ - name : Store benchmark result
113+ if : matrix.os == 'ubuntu-latest'
114+ uses : benchmark-action/github-action-benchmark@v1
115+ with :
116+ tool : " cargo"
117+ output-file-path : bench.txt
118+ summary-always : true
119+ comment-on-alert : true
120+ github-token : ${{ secrets.GITHUB_TOKEN }}
106121
107122 build_linux_wheels :
108123 name : Build wheels (linux)
Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ crate-type = [
1111 " cdylib" , # for Python extension
1212 " rlib" , # for benchmarking
1313]
14- name = " unblob_rust"
14+ name = " unblob"
15+ # disable Rust nightly benchmark feature. We use criterion
16+ # https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
17+ bench = false
1518
1619[dependencies ]
1720log = " 0.4.22"
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ fn shannon_entropy(c: &mut Criterion) {
1919 BenchmarkId :: from_parameter ( sample_size) ,
2020 & sample_size,
2121 |b, & size| {
22- b. iter ( || unblob_native :: math_tools:: shannon_entropy ( & sample[ 0 ..size] ) ) ;
22+ b. iter ( || unblob :: math_tools:: shannon_entropy ( & sample[ 0 ..size] ) ) ;
2323 } ,
2424 ) ;
2525 }
@@ -38,7 +38,7 @@ fn chi_square_probability(c: &mut Criterion) {
3838 BenchmarkId :: from_parameter ( sample_size) ,
3939 & sample_size,
4040 |b, & size| {
41- b. iter ( || unblob_native :: math_tools:: chi_square_probability ( & sample[ 0 ..size] ) ) ;
41+ b. iter ( || unblob :: math_tools:: chi_square_probability ( & sample[ 0 ..size] ) ) ;
4242 } ,
4343 ) ;
4444 }
You can’t perform that action at this time.
0 commit comments