diff --git a/Cargo.lock b/Cargo.lock index e6611c4..af4538e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 4 +version = 3 [[package]] name = "addr2line" @@ -50,6 +50,12 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "ansi-to-tui" version = "7.0.0" @@ -271,6 +277,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + [[package]] name = "bytemuck" version = "1.20.0" @@ -353,6 +365,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "castaway" version = "0.2.3" @@ -377,6 +395,33 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "clap" version = "4.5.23" @@ -604,6 +649,42 @@ dependencies = [ "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]] name = "crossbeam-deque" version = "0.8.5" @@ -1513,6 +1594,16 @@ dependencies = [ "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]] name = "hashbrown" version = "0.14.5" @@ -1777,12 +1868,32 @@ dependencies = [ "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]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -1823,6 +1934,16 @@ dependencies = [ "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]] name = "json5" version = "0.4.1" @@ -2041,6 +2162,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" 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]] name = "num_threads" version = "0.1.7" @@ -2116,6 +2246,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "oorandom" +version = "11.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" + [[package]] name = "option-ext" version = "0.2.0" @@ -2275,6 +2411,34 @@ dependencies = [ "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]] name = "polling" version = "3.7.4" @@ -2364,7 +2528,7 @@ dependencies = [ "crossterm", "indoc", "instability", - "itertools", + "itertools 0.13.0", "lru", "paste", "serde", @@ -2842,7 +3006,9 @@ dependencies = [ "color-eyre", "config", "copypasta", + "criterion", "crossterm", + "devicons", "directories", "human-panic", "lazy_static", @@ -3063,6 +3229,16 @@ dependencies = [ "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]] name = "tinyvec" version = "1.8.0" @@ -3258,7 +3434,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" dependencies = [ - "itertools", + "itertools 0.13.0", "unicode-segmentation", "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" 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]] name = "wayland-backend" version = "0.3.7" @@ -3485,6 +3715,16 @@ dependencies = [ "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]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index a3c3223..facc041 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,7 @@ name = "tv" [dependencies] # workspace dependencies + television-fuzzy = { path = "crates/television-fuzzy", version = "0.0.10" } television-derive = { path = "crates/television-derive", 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" 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] vergen-gix = { version = "1.0.0", features = ["build", "cargo", "rustc"] } diff --git a/benches/results_list_benchmark.rs b/benches/results_list_benchmark.rs new file mode 100644 index 0000000..02350b3 --- /dev/null +++ b/benches/results_list_benchmark.rs @@ -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); diff --git a/crates/television-screen/Cargo.toml b/crates/television-screen/Cargo.toml index f1799d0..6a041ca 100644 --- a/crates/television-screen/Cargo.toml +++ b/crates/television-screen/Cargo.toml @@ -16,9 +16,9 @@ readme.workspace = true [dependencies] ratatui = "0.29.0" serde = "1.0.215" -television-utils = { path = "../television-utils", version="0.0.10" } -television-channels = { path = "../television-channels", version="0.0.10" } -television-previewers = { path = "../television-previewers", version="0.0.10" } +television-utils = { path = "../television-utils", version = "0.0.10" } +television-channels = { path = "../television-channels", version = "0.0.10" } +television-previewers = { path = "../television-previewers", version = "0.0.10" } color-eyre = "0.6.3" ansi-to-tui = "7.0.0" syntect = "5.2.0"