-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #149
- Loading branch information
1 parent
e84c746
commit 2b1bf09
Showing
5 changed files
with
39 additions
and
37 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 |
---|---|---|
@@ -1,21 +1,20 @@ | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use gengo::Builder; | ||
use gengo::{Builder, Git}; | ||
|
||
fn head_benchmark(c: &mut Criterion) { | ||
fn git_benchmark(c: &mut Criterion) { | ||
let revs = { | ||
let mut revs: Vec<_> = (0..3).map(|n| format!("HEAD{}", "^".repeat(n))).collect(); | ||
revs.extend_from_slice(&["test/javascript".into()]); | ||
revs | ||
}; | ||
for rev in revs { | ||
let gengo = Builder::new(env!("CARGO_MANIFEST_DIR"), &rev) | ||
.build() | ||
.unwrap(); | ||
let git = Git::new(env!("CARGO_MANIFEST_DIR"), &rev).unwrap(); | ||
let gengo = Builder::new(git).build().unwrap(); | ||
c.bench_function(&format!("run on {}", rev), |b| { | ||
b.iter(|| gengo.analyze().unwrap()) | ||
}); | ||
} | ||
} | ||
|
||
criterion_group!(benches, head_benchmark); | ||
criterion_group!(benches, git_benchmark); | ||
criterion_main!(benches); |
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
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