-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched benchmarking to Divan + fixed spellcheck crashing issue + im…
…proved web perf
- Loading branch information
1 parent
2ebe258
commit 85c83f3
Showing
8 changed files
with
88 additions
and
272 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,32 +1,38 @@ | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use divan::{black_box, AllocProfiler, Bencher}; | ||
use harper_core::{Dictionary, Document, LintSet, Linter}; | ||
|
||
fn parse_demo(c: &mut Criterion) { | ||
let demo = include_str!("../../demo.md"); | ||
#[global_allocator] | ||
static ALLOC: AllocProfiler = AllocProfiler::system(); | ||
|
||
c.bench_function("parse_demo", |b| { | ||
b.iter(|| { | ||
let _document = Document::new_markdown(demo); | ||
}) | ||
static DEMO: &str = include_str!("../../demo.md"); | ||
|
||
#[divan::bench] | ||
fn parse_demo(bencher: Bencher) { | ||
bencher.bench_local(|| { | ||
let _document = Document::new_markdown(black_box(DEMO)); | ||
}); | ||
} | ||
|
||
#[divan::bench] | ||
fn create_lint_set(bencher: Bencher) { | ||
let dictionary = Dictionary::new(); | ||
|
||
c.bench_function("create_lint_set", |b| { | ||
b.iter(|| { | ||
let _lint_set = LintSet::new().with_standard(dictionary.clone()); | ||
}) | ||
bencher.bench_local(|| { | ||
let _lint_set = LintSet::new().with_standard(dictionary.clone()); | ||
}); | ||
} | ||
|
||
#[divan::bench] | ||
fn lint_demo(bencher: Bencher) { | ||
let dictionary = Dictionary::new(); | ||
let mut lint_set = LintSet::new().with_standard(dictionary); | ||
let document = Document::new_markdown(demo); | ||
let document = Document::new_markdown(black_box(DEMO)); | ||
|
||
c.bench_function("lint_demo", |b| { | ||
b.iter(|| { | ||
lint_set.lint(&document); | ||
}) | ||
bencher.bench_local(|| { | ||
lint_set.lint(&document); | ||
}); | ||
} | ||
|
||
criterion_group!(benches, parse_demo); | ||
criterion_main!(benches); | ||
fn main() { | ||
divan::main(); | ||
} |
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
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