Files
core/test/rust/performance/build/collections.rs
T
2026-11-03 03:32:07 +00:00

74 lines
2.8 KiB
Rust

//! 文本和集合对照的构建入口,与其他性能组共用正式生成器和 Cargo 配置。
use super::compare;
use std::path::Path;
pub(crate) fn run(core: &Path) -> bool {
if std::env::args().any(|argument| argument == "--text") {
compare(
core,
"text",
"text",
&(include_str!("../samples.rs").to_owned() + include_str!("../text.rs")),
&[
("GENERATED_CHAIN", "chain"),
("GENERATED_PAIR", "pair"),
("GENERATED_TEMPORARY", "temporarySuffix"),
("GENERATED_FORWARDED", "forwardedSuffix"),
("GENERATED_CONTAINS", "containsAll"),
("GENERATED_LIST_CONTAINS", "listContains"),
("GENERATED_TEXT_CONCAT", "concatenateText"),
("GENERATED_BYTES_CONCAT", "concatenateBytes"),
],
&[("SEARCH_PAIR", "SearchPair")],
);
return true;
}
if std::env::args().any(|argument| argument == "--map-values") {
compare(
core,
"map-values",
"map-values",
&(include_str!("../samples.rs").to_owned()
+ include_str!("../map_values/mod.rs")
+ include_str!("../map_values/select.rs")),
&[
("GENERATED_BUILD_TEXT", "buildText"),
("GENERATED_BUILD_NESTED", "buildNested"),
("GENERATED_OWNED_TEXT", "ownedText"),
("GENERATED_OWNED_NESTED", "ownedNested"),
("GENERATED_BORROWED_TEXT", "borrowedText"),
("GENERATED_BORROWED_NESTED", "borrowedNested"),
("GENERATED_LIST_FIRST", "firstText"),
("GENERATED_MAP_GET", "lookupText"),
("GENERATED_MAP_FILTER", "filterText"),
("GENERATED_MAP_FIND", "findText"),
],
&[],
);
return true;
}
if std::env::args().any(|argument| argument == "--storage") {
compare(
core,
"storage",
"storage",
&(include_str!("../samples.rs").to_owned() + include_str!("../storage.rs")),
&[
("GENERATED_LOOKUP", "lookup"),
("GENERATED_SCAN", "scan"),
("GENERATED_BUILD_MAP", "buildMap"),
("GENERATED_ENTRIES", "buildEntries"),
("GENERATED_BUILD_LIST", "buildList"),
("GENERATED_BUFFER_BUILD", "bufferBuild"),
("GENERATED_BUFFER_INSPECT", "bufferInspect"),
("GENERATED_RECORD_READ", "readScalarRows"),
("GENERATED_TEXT_LOOKUP", "lookupText"),
],
&[("BUFFER_STATE", "BufferState"), ("SCALAR_ROW", "ScalarRow")],
);
return true;
}
false
}