Super dictionary optimization

This commit is contained in:
2026-08-09 14:24:59 +03:00
parent e2133ce91a
commit 4676b0eeef
3 changed files with 147 additions and 69 deletions
Generated
+58 -2
View File
@@ -47,6 +47,12 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "aliasable"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]] [[package]]
name = "alloca" name = "alloca"
version = "0.4.0" version = "0.4.0"
@@ -1681,6 +1687,12 @@ dependencies = [
"hashbrown 0.17.1", "hashbrown 0.17.1",
] ]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.5.0" version = "0.5.0"
@@ -2001,6 +2013,7 @@ dependencies = [
"iced_renderer", "iced_renderer",
"log", "log",
"num-traits", "num-traits",
"ouroboros",
"rustc-hash 2.1.1", "rustc-hash 2.1.1",
"thiserror 2.0.18", "thiserror 2.0.18",
"unicode-segmentation", "unicode-segmentation",
@@ -3208,6 +3221,30 @@ dependencies = [
"pin-project-lite", "pin-project-lite",
] ]
[[package]]
name = "ouroboros"
version = "0.18.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0f050db9c44b97a94723127e6be766ac5c340c48f2c4bb3ffa11713744be59"
dependencies = [
"aliasable",
"ouroboros_macro",
"static_assertions",
]
[[package]]
name = "ouroboros_macro"
version = "0.18.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c7028bdd3d43083f6d8d4d5187680d0d3560d54df4cc9d752005268b41e64d0"
dependencies = [
"heck 0.4.1",
"proc-macro2",
"proc-macro2-diagnostics",
"quote",
"syn 2.0.114",
]
[[package]] [[package]]
name = "owned_ttf_parser" name = "owned_ttf_parser"
version = "0.25.1" version = "0.25.1"
@@ -3436,6 +3473,19 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "proc-macro2-diagnostics"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.114",
"version_check",
"yansi",
]
[[package]] [[package]]
name = "profiling" name = "profiling"
version = "1.0.17" version = "1.0.17"
@@ -6077,7 +6127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"heck", "heck 0.5.0",
"wit-parser", "wit-parser",
] ]
@@ -6088,7 +6138,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"heck", "heck 0.5.0",
"indexmap", "indexmap",
"prettyplease", "prettyplease",
"syn 2.0.114", "syn 2.0.114",
@@ -6224,6 +6274,12 @@ 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 = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
[[package]]
name = "yansi"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
[[package]] [[package]]
name = "yazi" name = "yazi"
version = "0.2.1" version = "0.2.1"
+5 -5
View File
@@ -4,7 +4,7 @@ version = "0.1.2"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
iced = { version = "0.14.0", features = ["tokio", "svg"]} iced = { version = "0.14.0", features = ["tokio", "svg", "lazy"]}
iced_core = "0.14.0" iced_core = "0.14.0"
rand = "0.10.2" rand = "0.10.2"
dirs = "6.0.0" dirs = "6.0.0"
@@ -28,7 +28,7 @@ criterion = "0.8.2"
name = "split_bench" # Имя файла в benches/ без расширения name = "split_bench" # Имя файла в benches/ без расширения
harness = false # Отключаем стандартный тестовый раннер harness = false # Отключаем стандартный тестовый раннер
[profile.release] #[profile.release]
codegen-units = 1 #codegen-units = 1
lto = true #lto = true
opt-level = 3 #opt-level = 3
+84 -62
View File
@@ -338,71 +338,84 @@ impl DictionaryState {
continue; continue;
} }
let mut line = Row::new().width(Length::Fill).align_y(Center); let word_line_data = WordLineState{
line = line.push( is_included: self.include_map[i],
checkbox(self.include_map[i]) key: word.key.clone(),
.label("") value: word.value.clone(),
.spacing(15) tags: word.tags.clone(),
.on_toggle(move |b| Include(i, b)), id: word.id,
);
line = line.push(
text_input("Слово", &word.key)
.size(ACCENT_FONT_SIZE)
.width(Length::Fill)
.on_input(move |string| SetKey(i, string))
.on_submit(SubmitWord(i))
.style(|x, status| {
let mut default_style = default(x, status);
default_style.border.radius = 0.0.into();
default_style
}),
);
line = line.push(
text_input("Перевод", &word.value)
.size(ACCENT_FONT_SIZE)
.width(Length::Fill)
.on_input(move |string| SetValue(i, string))
.on_submit(SubmitWord(i))
.style(|x, status| {
let mut default_style = default(x, status);
default_style.border.radius = 0.0.into();
default_style
}),
);
line = line.push(
text_input("Теги", &word.tags)
.size(ACCENT_FONT_SIZE)
.width(Length::Fill)
.on_input(move |string| SetTags(i, string))
.on_submit(SubmitWord(i))
.style(|x, status| {
let mut default_style = default(x, status);
default_style.border.radius = 0.0.into();
default_style
}),
);
let line_button = || {
let action = WordAction(i);
if word.id == 0 {
return button("-").on_press(action).style(|_x, _status| Style {
background: None,
text_color: Color::BLACK,
border: Border::default(),
shadow: Shadow::default(),
snap: false,
});
}
button("").on_press(WordAction(i)).width(15)
}; };
line = line.push(line_button()).push(space().width(10)); let lazy_line = lazy(word_line_data, move |data| {
let mut line = Row::new().width(Length::Fill).align_y(Center);
line = line.push(
checkbox(data.is_included)
.label("")
.spacing(15)
.on_toggle(move |b| Include(i, b)),
);
col = col.push(line); line = line.push(
text_input("Слово", &data.key)
.size(ACCENT_FONT_SIZE)
.width(Length::Fill)
.on_input(move |string| SetKey(i, string))
.on_submit(SubmitWord(i))
.style(|x, status| {
let mut default_style = default(x, status);
default_style.border.radius = 0.0.into();
default_style
}),
);
line = line.push(
text_input("Перевод", &data.value)
.size(ACCENT_FONT_SIZE)
.width(Length::Fill)
.on_input(move |string| SetValue(i, string))
.on_submit(SubmitWord(i))
.style(|x, status| {
let mut default_style = default(x, status);
default_style.border.radius = 0.0.into();
default_style
}),
);
line = line.push(
text_input("Теги", &data.tags)
.size(ACCENT_FONT_SIZE)
.width(Length::Fill)
.on_input(move |string| SetTags(i, string))
.on_submit(SubmitWord(i))
.style(|x, status| {
let mut default_style = default(x, status);
default_style.border.radius = 0.0.into();
default_style
}),
);
let line_button = || {
let action = WordAction(i);
if data.id == 0 {
return button("-").on_press(action).style(|_x, _status| Style {
background: None,
text_color: Color::BLACK,
border: Border::default(),
shadow: Shadow::default(),
snap: false,
});
}
button("").on_press(WordAction(i)).width(15)
};
line = line.push(line_button()).push(space().width(10));
line
});
col = col.push(lazy_line);
} }
println!("Words rendering time: {:?}", time.elapsed()); println!("Words rendering time: {:?}", time.elapsed());
@@ -573,3 +586,12 @@ pub fn app_data_dir() -> PathBuf {
dir dir
} }
#[derive(Hash, PartialEq, Eq)]
struct WordLineState{
is_included: bool,
key: String,
value: String,
tags: String,
id: u32
}