-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from whisperfish/compact-national
Fit NationalNumber in 64 bits
- Loading branch information
Showing
4 changed files
with
65 additions
and
41 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; | ||
|
||
pub fn criterion_benchmark(c: &mut Criterion) { | ||
let cases = [ | ||
"+80012340000", | ||
"+61406823897", | ||
"+611900123456", | ||
"+32474091150", | ||
"+34666777888", | ||
"+34612345678", | ||
"+441212345678", | ||
"+13459492311", | ||
"+16137827274", | ||
"+1 520 878 2491", | ||
"+1-520-878-2491", | ||
]; | ||
|
||
for case in cases { | ||
c.bench_with_input(BenchmarkId::new("parse", case), &case, |b, case| { | ||
b.iter(|| { | ||
let pn = black_box(case); | ||
phonenumber::parse(None, pn) | ||
}) | ||
}); | ||
} | ||
} | ||
|
||
criterion_group!(benches, criterion_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