-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve tagger: Return iterators over
WordData
, remove groups, para…
…llelize deserialization (#70) * use vec instead of hashmap internally in tagger * parallelize tagger deserialization * return iterators in tagger * chore: improve benches a bit (#71) * remove redundant vectors in chunker * cleanup wordidmap * update changelog Co-authored-by: Bernhard Schuster <[email protected]>
- Loading branch information
1 parent
26e1983
commit 602aaf1
Showing
10 changed files
with
417 additions
and
241 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,15 +1,31 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use nlprule::{Rules, Tokenizer}; | ||
use std::time::Duration; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
fn parse_tokenizer(c: &mut Criterion) { | ||
c.bench_function("load tokenizer", |b| { | ||
b.iter(|| Tokenizer::new(black_box("../storage/en_tokenizer.bin")).unwrap()) | ||
}); | ||
} | ||
|
||
fn parse_rules(c: &mut Criterion) { | ||
c.bench_function("load rules", |b| { | ||
b.iter(|| Rules::new(black_box("../storage/en_rules.bin")).unwrap()) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); | ||
fn no_warmup_criterion() -> Criterion { | ||
Criterion::default() | ||
.sample_size(20) | ||
.warm_up_time(Duration::from_nanos(1)) | ||
} | ||
|
||
criterion_group!( | ||
name = parse; | ||
config = no_warmup_criterion(); | ||
targets = | ||
parse_rules, | ||
parse_tokenizer, | ||
); | ||
|
||
criterion_main!(parse); |
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
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
Oops, something went wrong.