@@ -6,41 +6,34 @@ extern crate test;
66use test:: Bencher ;
77use unicode_normalization:: UnicodeNormalization ;
88
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-
169#[ bench]
1710fn 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" ) ) ;
1912}
2013
2114#[ bench]
2215fn 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" ) ) ;
2417}
2518
2619#[ bench]
2720fn 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" ) ) ;
2922}
3023
3124#[ bench]
3225fn 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" ) ) ;
3427}
3528
3629#[ bench]
3730fn 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" ) ) ;
3932}
4033
4134#[ bench]
4235fn 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" ) ) ;
4437}
4538
4639#[ bench]
0 commit comments