2019-01-22 17:01:33 -05:00
|
|
|
#![feature(test)]
|
|
|
|
|
|
|
|
extern crate test;
|
|
|
|
|
|
|
|
mod data;
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn tokenize_empty(b: &mut test::Bencher) {
|
2019-04-16 19:27:55 -04:00
|
|
|
b.iter(|| defenestrate::identifier::tokenize(data::EMPTY.as_bytes()).collect::<Vec<_>>());
|
2019-01-22 17:01:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn tokenize_no_tokens(b: &mut test::Bencher) {
|
2019-04-16 19:27:55 -04:00
|
|
|
b.iter(|| defenestrate::identifier::tokenize(data::NO_TOKENS.as_bytes()).collect::<Vec<_>>());
|
2019-01-22 17:01:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn tokenize_single_token(b: &mut test::Bencher) {
|
2019-04-16 19:27:55 -04:00
|
|
|
b.iter(|| defenestrate::identifier::tokenize(data::SINGLE_TOKEN.as_bytes()).collect::<Vec<_>>());
|
2019-01-22 17:01:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn tokenize_sherlock(b: &mut test::Bencher) {
|
2019-04-16 19:27:55 -04:00
|
|
|
b.iter(|| defenestrate::identifier::tokenize(data::SHERLOCK.as_bytes()).collect::<Vec<_>>());
|
2019-01-22 17:01:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn tokenize_code(b: &mut test::Bencher) {
|
2019-04-16 19:27:55 -04:00
|
|
|
b.iter(|| defenestrate::identifier::tokenize(data::CODE.as_bytes()).collect::<Vec<_>>());
|
2019-01-22 17:01:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn tokenize_corpus(b: &mut test::Bencher) {
|
2019-04-16 19:27:55 -04:00
|
|
|
b.iter(|| defenestrate::identifier::tokenize(data::CORPUS.as_bytes()).collect::<Vec<_>>());
|
2019-01-22 17:01:33 -05:00
|
|
|
}
|