Bug 1927094 - optimize lineScrollAmount so it doesn't iterate over all tabs, r=mconley
[gecko.git] / third_party / rust / strsim / benches / benches.rs
blob15c7041b6442a7d87af2ffd2294c611acdc67501
1 //! Benchmarks for strsim.
3 #![feature(test)]
5 extern crate strsim;
6 extern crate test;
7 use self::test::Bencher;
9 #[bench]
10 fn bench_hamming(bencher: &mut Bencher) {
11     let a = "ACAAGATGCCATTGTCCCCCGGCCTCCTGCTGCTGCTGCTCTCCGGGG";
12     let b = "CCTGGAGGGTGGCCCCACCGGCCGAGACAGCGAGCATATGCAGGAAGC";
13     bencher.iter(|| {
14         strsim::hamming(a, b).unwrap();
15     })
18 #[bench]
19 fn bench_jaro(bencher: &mut Bencher) {
20     let a = "Philosopher Friedrich Nietzsche";
21     let b = "Philosopher Jean-Paul Sartre";
22     bencher.iter(|| {
23         strsim::jaro(a, b);
24     })
27 #[bench]
28 fn bench_jaro_winkler(bencher: &mut Bencher) {
29     let a = "Philosopher Friedrich Nietzsche";
30     let b = "Philosopher Jean-Paul Sartre";
31     bencher.iter(|| {
32         strsim::jaro_winkler(a, b);
33     })
36 #[bench]
37 fn bench_levenshtein(bencher: &mut Bencher) {
38     let a = "Philosopher Friedrich Nietzsche";
39     let b = "Philosopher Jean-Paul Sartre";
40     bencher.iter(|| {
41         strsim::levenshtein(a, b);
42     })
45 #[bench]
46 fn bench_levenshtein_on_u8(bencher: &mut Bencher) {
47     bencher.iter(|| {
48         strsim::generic_levenshtein(&vec![0u8; 30], &vec![7u8; 31]);
49     })
52 #[bench]
53 fn bench_normalized_levenshtein(bencher: &mut Bencher) {
54     let a = "Philosopher Friedrich Nietzsche";
55     let b = "Philosopher Jean-Paul Sartre";
56     bencher.iter(|| {
57         strsim::normalized_levenshtein(a, b);
58     })
61 #[bench]
62 fn bench_osa_distance(bencher: &mut Bencher) {
63     let a = "Philosopher Friedrich Nietzsche";
64     let b = "Philosopher Jean-Paul Sartre";
65     bencher.iter(|| {
66         strsim::osa_distance(a, b);
67     })
70 #[bench]
71 fn bench_damerau_levenshtein(bencher: &mut Bencher) {
72     let a = "Philosopher Friedrich Nietzsche";
73     let b = "Philosopher Jean-Paul Sartre";
74     bencher.iter(|| {
75         strsim::damerau_levenshtein(a, b);
76     })
79 #[bench]
80 fn bench_normalized_damerau_levenshtein(bencher: &mut Bencher) {
81     let a = "Philosopher Friedrich Nietzsche";
82     let b = "Philosopher Jean-Paul Sartre";
83     bencher.iter(|| {
84         strsim::normalized_damerau_levenshtein(a, b);
85     })
88 #[bench]
89 fn bench_sorensen_dice(bencher: &mut Bencher) {
90     let a = "Philosopher Friedrich Nietzsche";
91     let b = "Philosopher Jean-Paul Sartre";
92     bencher.iter(|| {
93         strsim::sorensen_dice(a, b);
94     })