]> git.lizzy.rs Git - rust.git/blob - library/core/benches/str/corpora.rs
Fix zh::SMALL string in core::str benchmarks
[rust.git] / library / core / benches / str / corpora.rs
1 //! Exposes a number of modules with different kinds of strings.
2 //!
3 //! Each module contains `&str` constants named `SMALL`, `MEDIUM`, `LARGE`, and
4 //! `HUGE`.
5 //!
6 //! - The `SMALL` string is generally around 30-40 bytes.
7 //! - The `MEDIUM` string is generally around 600-700 bytes.
8 //! - The `LARGE` string is the `MEDIUM` string repeated 8x, and is around 5kb.
9 //! - The `HUGE` string is the `LARGE` string repeated 8x (or the `MEDIUM`
10 //!   string repeated 64x), and is around 40kb.
11 //!
12 //! Except for `mod emoji` (which is just a bunch of emoji), the strings were
13 //! pulled from (localizations of) rust-lang.org.
14
15 macro_rules! repeat8 {
16     ($s:expr) => {
17         concat!($s, $s, $s, $s, $s, $s, $s, $s)
18     };
19 }
20
21 macro_rules! define_consts {
22     ($s:literal) => {
23         pub const MEDIUM: &str = $s;
24         pub const LARGE: &str = repeat8!($s);
25         pub const HUGE: &str = repeat8!(repeat8!(repeat8!($s)));
26     };
27 }
28
29 pub mod en {
30     pub const SMALL: &str = "Mary had a little lamb, Little lamb";
31     define_consts! {
32         "Rust is blazingly fast and memory-efficient: with no runtime or garbage
33          collector, it can power performance-critical services, run on embedded
34          devices, and easily integrate with other languages.  Rust’s rich type system
35          and ownership model guarantee memory-safety and thread-safety — enabling you
36          to eliminate many classes of bugs at compile-time.  Rust has great
37          documentation, a friendly compiler with useful error messages, and top-notch
38          tooling — an integrated package manager and build tool, smart multi-editor
39          support with auto-completion and type inspections, an auto-formatter, and
40          more."
41     }
42 }
43
44 pub mod zh {
45     pub const SMALL: &str = "速度惊人且内存利用率极高";
46     define_consts! {
47         "Rust   速度惊人且内存利用率极高。由于\
48          没有运行时和垃圾回收,它能够胜任对性能要\
49          求特别高的服务,可以在嵌入式设备上运行,\
50          还能轻松和其他语言集成。Rust 丰富的类型\
51          系统和所有权模型保证了内存安全和线程安全,\
52          让您在编译期就能够消除各种各样的错误。\
53          Rust 拥有出色的文档、友好的编译器和清晰\
54          的错误提示信息, 还集成了一流的工具——\
55          包管理器和构建工具, 智能地自动补全和类\
56          型检验的多编辑器支持, 以及自动格式化代\
57          码等等。"
58     }
59 }
60
61 pub mod ru {
62     pub const SMALL: &str = "Сотни компаний по";
63     define_consts! {
64         "Сотни компаний по всему миру используют Rust в реальных\
65          проектах для быстрых кросс-платформенных решений с\
66          ограниченными ресурсами. Такие проекты, как Firefox,\
67          Dropbox и Cloudflare, используют Rust. Rust отлично\
68          подходит как для стартапов, так и для больших компаний,\
69          как для встраиваемых устройств, так и для масштабируемых\
70          web-сервисов. Мой самый большой комплимент Rust."
71     }
72 }
73
74 pub mod emoji {
75     pub const SMALL: &str = "😀😃😄😁😆😅🤣😂🙂🙃😉😊😇🥰😍🤩😘";
76     define_consts! {
77         "😀😃😄😁😆😅🤣😂🙂🙃😉😊😇🥰😍🤩😘😗☺😚😙🥲😋😛😜🤪😝🤑🤗🤭🤫🤔🤐🤨😐😑😶😶‍🌫️😏😒\
78          🙄😬😮‍💨🤥😌😔😪🤤😴😷🤒🤕🤢🤮🤧🥵🥶🥴😵😵‍💫🤯��🥳🥸😎🤓🧐😕😟🙁☹😮😯😲😳🥺😦😧😨\
79          😰😥😢😭😱😖😣😞😓😩😫🥱😤😡😠🤬😈👿💀☠💩🤡👹👺👻👽👾🤖😺😸😹😻😼😽🙀😿😾🙈🙉🙊\
80          💋💌💘💝💖💗💓��💕💟❣💔❤️‍🔥❤️‍🩹❤🧡💛💚💙💜🤎🖤🤍💯💢💥💫💦💨🕳💬👁️‍🗨️🗨🗯💭💤👋\
81          🤚🖐✋🖖👌🤌🤏✌"
82     }
83 }