• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![feature(test)]
2 
3 extern crate test;
4 
5 use test::Bencher;
6 use uuid::Uuid;
7 
8 #[bench]
bench_parse_valid_strings(b: &mut Bencher)9 fn bench_parse_valid_strings(b: &mut Bencher) {
10     b.iter(|| {
11         // Valid
12         let _ = Uuid::parse_str("00000000000000000000000000000000");
13         let _ = Uuid::parse_str("67e55044-10b1-426f-9247-bb680e5fe0c8");
14         let _ = Uuid::parse_str("67e55044-10b1-426f-9247-bb680e5fe0c8");
15         let _ = Uuid::parse_str("F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4");
16         let _ = Uuid::parse_str("67e5504410b1426f9247bb680e5fe0c8");
17         let _ = Uuid::parse_str("01020304-1112-2122-3132-414243444546");
18         let _ =
19             Uuid::parse_str("urn:uuid:67e55044-10b1-426f-9247-bb680e5fe0c8");
20 
21         // Nil
22         let _ = Uuid::parse_str("00000000000000000000000000000000");
23         let _ = Uuid::parse_str("00000000-0000-0000-0000-000000000000");
24     });
25 }
26 
27 #[bench]
bench_valid_hyphenated(b: &mut Bencher)28 fn bench_valid_hyphenated(b: &mut Bencher) {
29     b.iter(|| {
30         let _ = Uuid::parse_str("67e55044-10b1-426f-9247-bb680e5fe0c8");
31     });
32 }
33 
34 #[bench]
bench_valid_short(b: &mut Bencher)35 fn bench_valid_short(b: &mut Bencher) {
36     b.iter(|| {
37         let _ = Uuid::parse_str("67e5504410b1426f9247bb680e5fe0c8");
38     });
39 }
40