• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // This file is part of ICU4X. For terms of use, please see the file
2 // called LICENSE at the top level of the ICU4X source tree
3 // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4 
5 // This file was adapted from parts of https://github.com/zbraniecki/tinystr
6 
7 pub static STRINGS_4: &[&str] = &[
8     "US", "GB", "AR", "Hans", "CN", "AT", "PL", "FR", "AT", "Cyrl", "SR", "NO", "FR", "MK", "UK",
9 ];
10 
11 pub static STRINGS_8: &[&str] = &[
12     "Latn", "windows", "AR", "Hans", "macos", "AT", "pl", "FR", "en", "Cyrl", "SR", "NO", "419",
13     "und", "UK",
14 ];
15 
16 pub static STRINGS_16: &[&str] = &[
17     "Latn",
18     "windows",
19     "AR",
20     "Hans",
21     "macos",
22     "AT",
23     "infiniband",
24     "FR",
25     "en",
26     "Cyrl",
27     "FromIntegral",
28     "NO",
29     "419",
30     "MacintoshOSX2019",
31     "UK",
32 ];
33 
34 #[macro_export]
35 macro_rules! bench_block {
36     ($c:expr, $name:expr, $action:ident) => {
37         let mut group4 = $c.benchmark_group(&format!("{}/4", $name));
38         group4.bench_function("String", $action!(String, STRINGS_4));
39         group4.bench_function("TinyAsciiStr<4>", $action!(TinyAsciiStr<4>, STRINGS_4));
40         group4.bench_function("TinyAsciiStr<8>", $action!(TinyAsciiStr<8>, STRINGS_4));
41         group4.bench_function("TinyAsciiStr<16>", $action!(TinyAsciiStr<16>, STRINGS_4));
42         group4.finish();
43 
44         let mut group8 = $c.benchmark_group(&format!("{}/8", $name));
45         group8.bench_function("String", $action!(String, STRINGS_8));
46         group8.bench_function("TinyAsciiStr<8>", $action!(TinyAsciiStr<8>, STRINGS_8));
47         group8.bench_function("TinyAsciiStr<16>", $action!(TinyAsciiStr<16>, STRINGS_8));
48         group8.finish();
49 
50         let mut group16 = $c.benchmark_group(&format!("{}/16", $name));
51         group16.bench_function("String", $action!(String, STRINGS_16));
52         group16.bench_function("TinyAsciiStr<16>", $action!(TinyAsciiStr<16>, STRINGS_16));
53         group16.finish();
54     };
55 }
56