perf: add bench for build results list (#107)

This PR adds a benchmark for performance-critical function
`build_results_list` from `television_screen::results`

This should allows `television` to track performances improvements or
regressions across time for that function (and other in the future)

---------

Co-authored-by: alexpasmantier <alex.pasmant@gmail.com>
This commit is contained in:
Bertrand Chardon 2024-12-08 18:43:38 +01:00 committed by GitHub
parent 54399e3777
commit c0db566a48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 726 additions and 6 deletions

246
Cargo.lock generated
View File

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 4 version = 3
[[package]] [[package]]
name = "addr2line" name = "addr2line"
@ -50,6 +50,12 @@ version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "anes"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
[[package]] [[package]]
name = "ansi-to-tui" name = "ansi-to-tui"
version = "7.0.0" version = "7.0.0"
@ -271,6 +277,12 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "bumpalo"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.20.0" version = "1.20.0"
@ -353,6 +365,12 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]]
name = "cast"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]] [[package]]
name = "castaway" name = "castaway"
version = "0.2.3" version = "0.2.3"
@ -377,6 +395,33 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "ciborium"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e"
dependencies = [
"ciborium-io",
"ciborium-ll",
"serde",
]
[[package]]
name = "ciborium-io"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
[[package]]
name = "ciborium-ll"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
dependencies = [
"ciborium-io",
"half",
]
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.23" version = "4.5.23"
@ -604,6 +649,42 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "criterion"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f"
dependencies = [
"anes",
"cast",
"ciborium",
"clap",
"criterion-plot",
"is-terminal",
"itertools 0.10.5",
"num-traits",
"once_cell",
"oorandom",
"plotters",
"rayon",
"regex",
"serde",
"serde_derive",
"serde_json",
"tinytemplate",
"walkdir",
]
[[package]]
name = "criterion-plot"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
dependencies = [
"cast",
"itertools 0.10.5",
]
[[package]] [[package]]
name = "crossbeam-deque" name = "crossbeam-deque"
version = "0.8.5" version = "0.8.5"
@ -1513,6 +1594,16 @@ dependencies = [
"regex-syntax 0.8.5", "regex-syntax 0.8.5",
] ]
[[package]]
name = "half"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
dependencies = [
"cfg-if",
"crunchy",
]
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.14.5" version = "0.14.5"
@ -1777,12 +1868,32 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "is-terminal"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
dependencies = [
"hermit-abi",
"libc",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "is_terminal_polyfill" name = "is_terminal_polyfill"
version = "1.70.1" version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.13.0" version = "0.13.0"
@ -1823,6 +1934,16 @@ dependencies = [
"jiff-tzdb", "jiff-tzdb",
] ]
[[package]]
name = "js-sys"
version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7"
dependencies = [
"once_cell",
"wasm-bindgen",
]
[[package]] [[package]]
name = "json5" name = "json5"
version = "0.4.1" version = "0.4.1"
@ -2041,6 +2162,15 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "num_threads" name = "num_threads"
version = "0.1.7" version = "0.1.7"
@ -2116,6 +2246,12 @@ dependencies = [
"pkg-config", "pkg-config",
] ]
[[package]]
name = "oorandom"
version = "11.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9"
[[package]] [[package]]
name = "option-ext" name = "option-ext"
version = "0.2.0" version = "0.2.0"
@ -2275,6 +2411,34 @@ dependencies = [
"time", "time",
] ]
[[package]]
name = "plotters"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747"
dependencies = [
"num-traits",
"plotters-backend",
"plotters-svg",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "plotters-backend"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a"
[[package]]
name = "plotters-svg"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
dependencies = [
"plotters-backend",
]
[[package]] [[package]]
name = "polling" name = "polling"
version = "3.7.4" version = "3.7.4"
@ -2364,7 +2528,7 @@ dependencies = [
"crossterm", "crossterm",
"indoc", "indoc",
"instability", "instability",
"itertools", "itertools 0.13.0",
"lru", "lru",
"paste", "paste",
"serde", "serde",
@ -2842,7 +3006,9 @@ dependencies = [
"color-eyre", "color-eyre",
"config", "config",
"copypasta", "copypasta",
"criterion",
"crossterm", "crossterm",
"devicons",
"directories", "directories",
"human-panic", "human-panic",
"lazy_static", "lazy_static",
@ -3063,6 +3229,16 @@ dependencies = [
"zerovec", "zerovec",
] ]
[[package]]
name = "tinytemplate"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
dependencies = [
"serde",
"serde_json",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.8.0" version = "1.8.0"
@ -3258,7 +3434,7 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf"
dependencies = [ dependencies = [
"itertools", "itertools 0.13.0",
"unicode-segmentation", "unicode-segmentation",
"unicode-width 0.1.14", "unicode-width 0.1.14",
] ]
@ -3389,6 +3565,60 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396"
dependencies = [
"cfg-if",
"once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
dependencies = [
"bumpalo",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6"
[[package]] [[package]]
name = "wayland-backend" name = "wayland-backend"
version = "0.3.7" version = "0.3.7"
@ -3485,6 +3715,16 @@ dependencies = [
"pkg-config", "pkg-config",
] ]
[[package]]
name = "web-sys"
version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" version = "0.3.9"

View File

@ -54,6 +54,7 @@ name = "tv"
[dependencies] [dependencies]
# workspace dependencies # workspace dependencies
television-fuzzy = { path = "crates/television-fuzzy", version = "0.0.10" } television-fuzzy = { path = "crates/television-fuzzy", version = "0.0.10" }
television-derive = { path = "crates/television-derive", version = "0.0.10" } television-derive = { path = "crates/television-derive", version = "0.0.10" }
television-screen = { path = "crates/television-screen", version = "0.0.10" } television-screen = { path = "crates/television-screen", version = "0.0.10" }
@ -82,6 +83,13 @@ human-panic = "2.0.2"
copypasta = "0.10.1" copypasta = "0.10.1"
ansi-to-tui = "7.0.0" ansi-to-tui = "7.0.0"
[dev-dependencies]
criterion = "0.5.1"
devicons = "0.6.11"
[[bench]]
name = "results_list_benchmark"
harness = false
[build-dependencies] [build-dependencies]
vergen-gix = { version = "1.0.0", features = ["build", "cargo", "rustc"] } vergen-gix = { version = "1.0.0", features = ["build", "cargo", "rustc"] }

View File

@ -0,0 +1,472 @@
use criterion::{criterion_group, criterion_main, Criterion};
use devicons::FileIcon;
use ratatui::layout::Alignment;
use ratatui::prelude::{Line, Style};
use ratatui::widgets::{Block, BorderType, Borders, ListDirection, Padding};
use television_channels::entry::{Entry, PreviewType};
use television_screen::colors::BORDER_COLOR;
use television_screen::results::build_results_list;
pub fn results_list_benchmark(c: &mut Criterion) {
let mut icon_color_cache = std::collections::HashMap::default();
// FIXME: there's probably a way to have this as a benchmark asset
// possible as a JSON file and to load it for the benchmark using Serde
// I don't know how exactly right now just having it here instead
let entries = [
Entry {
name: "typeshed/LICENSE".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{f016}',
color: "#7e8e91",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/README.md".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{f48a}',
color: "#dddddd",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/re.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/io.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/gc.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/uu.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/nt.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/dis.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/imp.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/bdb.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/abc.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/cgi.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/bz2.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/grp.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/ast.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/csv.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/pdb.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/pwd.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/ssl.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/tty.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/nis.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/pty.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/cmd.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/tests/utils.py".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/pyproject.toml".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e6b2}',
color: "#9c4221",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/MAINTAINERS.md".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{f48a}',
color: "#dddddd",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/enum.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/hmac.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/uuid.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/glob.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/_ast.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/_csv.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/code.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/spwd.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/_msi.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
Entry {
name: "typeshed/stdlib/time.pyi".to_string(),
value: None,
name_match_ranges: Some(vec![(0, 1), (1, 2), (2, 3), (3, 4)]),
value_match_ranges: None,
icon: Some(FileIcon {
icon: '\u{e606}',
color: "#ffbc03",
}),
line_number: None,
preview_type: PreviewType::Files,
},
];
c.bench_function("results_list", |b| {
b.iter(|| {
build_results_list(
Block::default()
.title_top(
Line::from(" Results ").alignment(Alignment::Center),
)
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.border_style(Style::default().fg(BORDER_COLOR))
.style(Style::default())
.padding(Padding::right(1)),
&entries,
ListDirection::BottomToTop,
None,
false,
&mut icon_color_cache,
);
})
});
}
criterion_group!(benches, results_list_benchmark);
criterion_main!(benches);

View File

@ -16,9 +16,9 @@ readme.workspace = true
[dependencies] [dependencies]
ratatui = "0.29.0" ratatui = "0.29.0"
serde = "1.0.215" serde = "1.0.215"
television-utils = { path = "../television-utils", version="0.0.10" } television-utils = { path = "../television-utils", version = "0.0.10" }
television-channels = { path = "../television-channels", version="0.0.10" } television-channels = { path = "../television-channels", version = "0.0.10" }
television-previewers = { path = "../television-previewers", version="0.0.10" } television-previewers = { path = "../television-previewers", version = "0.0.10" }
color-eyre = "0.6.3" color-eyre = "0.6.3"
ansi-to-tui = "7.0.0" ansi-to-tui = "7.0.0"
syntect = "5.2.0" syntect = "5.2.0"