@@ -6,41 +6,34 @@ extern crate test;
6
6
use test:: Bencher ;
7
7
use unicode_normalization:: UnicodeNormalization ;
8
8
9
- macro_rules! bench_check {
10
- ( $b: ident, $s: expr, $form: ident) => {
11
- let s = $s;
12
- $b. iter( || s. chars( ) . eq( s. $form( ) ) ) ;
13
- }
14
- }
15
-
16
9
#[ bench]
17
10
fn bench_is_nfc_ascii ( b : & mut Bencher ) {
18
- bench_check ! ( b , "all types of normalized" , nfc ) ;
11
+ b . iter ( || unicode_normalization :: is_nfc ( "all types of normalized" ) ) ;
19
12
}
20
13
21
14
#[ bench]
22
15
fn bench_is_nfc_normalized ( b : & mut Bencher ) {
23
- bench_check ! ( b , "Introducci\u{00f3} n a Unicode.pdf" , nfc ) ;
16
+ b . iter ( || unicode_normalization :: is_nfc ( "Introducci\u{00f3} n a Unicode.pdf" ) ) ;
24
17
}
25
18
26
19
#[ bench]
27
20
fn bench_is_nfc_not_normalized ( b : & mut Bencher ) {
28
- bench_check ! ( b , "Introduccio\u{0301} n a Unicode.pdf" , nfc ) ;
21
+ b . iter ( || unicode_normalization :: is_nfc ( "Introduccio\u{0301} n a Unicode.pdf" ) ) ;
29
22
}
30
23
31
24
#[ bench]
32
25
fn bench_is_nfd_ascii ( b : & mut Bencher ) {
33
- bench_check ! ( b , "an easy string to check" , nfd ) ;
26
+ b . iter ( || unicode_normalization :: is_nfd ( "an easy string to check" ) ) ;
34
27
}
35
28
36
29
#[ bench]
37
30
fn bench_is_nfd_normalized ( b : & mut Bencher ) {
38
- bench_check ! ( b , "Introduccio\u{0301} n a Unicode.pdf" , nfd ) ;
31
+ b . iter ( || unicode_normalization :: is_nfd ( "Introduccio\u{0301} n a Unicode.pdf" ) ) ;
39
32
}
40
33
41
34
#[ bench]
42
35
fn bench_is_nfd_not_normalized ( b : & mut Bencher ) {
43
- bench_check ! ( b , "Introducci\u{00f3} n a Unicode.pdf" , nfd ) ;
36
+ b . iter ( || unicode_normalization :: is_nfd ( "Introducci\u{00f3} n a Unicode.pdf" ) ) ;
44
37
}
45
38
46
39
#[ bench]
0 commit comments