Skip to content

Commit

Permalink
fix: Fix benchmarks and add them to CI (#601)
Browse files Browse the repository at this point in the history
This makes sure that clippy and cargo test also run on benchmarks in CI so they
stay up to date with the code.
  • Loading branch information
loewenheim committed Jun 22, 2022
1 parent 16fa09f commit 33fd1b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --workspace --tests --examples -- -D clippy::all
args: --all-features --workspace --all-targets -- -D clippy::all

- run: make lint-python

Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-features
args: --workspace --all-features --all-targets

test-python:
strategy:
Expand Down
20 changes: 13 additions & 7 deletions symbolic-symcache/benches/bench_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ use criterion::{criterion_group, criterion_main, Criterion};

use symbolic_common::ByteView;
use symbolic_debuginfo::Object;
use symbolic_symcache::SymCacheWriter;
use symbolic_symcache::SymCacheConverter;
use symbolic_testutils::fixture;

fn bench_write_linux(c: &mut Criterion) {
c.bench_function("write_linux", |b| {
let buffer = ByteView::open(fixture("linux/crash.debug")).expect("open");
b.iter(|| {
let object = Object::parse(&buffer).expect("parse");
SymCacheWriter::write_object(&object, Cursor::new(Vec::new()))
let mut converter = SymCacheConverter::new();
converter.process_object(&object).expect("process_object");
converter
.serialize(&mut Cursor::new(Vec::new()))
.expect("write_object")
.into_inner()
});
});
}
Expand All @@ -26,9 +28,11 @@ fn bench_write_macos(c: &mut Criterion) {

b.iter(|| {
let object = Object::parse(&buffer).expect("parse");
SymCacheWriter::write_object(&object, Cursor::new(Vec::new()))
let mut converter = SymCacheConverter::new();
converter.process_object(&object).expect("process_object");
converter
.serialize(&mut Cursor::new(Vec::new()))
.expect("write_object")
.into_inner()
});
});
}
Expand All @@ -38,9 +42,11 @@ fn bench_write_breakpad(c: &mut Criterion) {
let buffer = ByteView::open(fixture("windows/crash.sym")).expect("open");
b.iter(|| {
let object = Object::parse(&buffer).expect("parse");
SymCacheWriter::write_object(&object, Cursor::new(Vec::new()))
let mut converter = SymCacheConverter::new();
converter.process_object(&object).expect("process_object");
converter
.serialize(&mut Cursor::new(Vec::new()))
.expect("write_object")
.into_inner()
});
});
}
Expand Down

0 comments on commit 33fd1b0

Please sign in to comment.