perf(app,core): bounded image cache, shrunk poster cache, in-place watch updates

- ImageCache drops the picture asked for longest ago past 256 MiB and
  uploads at most six textures a frame
- posters and thumbnails larger than a card are stored scaled down, so
  a cached grid no longer decodes and resizes full backdrops every launch
- a saved watch state patches the library in place instead of rebuilding
  it from the catalog; the offline index reuses the library just built
- download byte progress sends one row, not a sorted copy of every row
- the CJK fallback font is found and read off the UI thread
- the watch-state upsert uses a cached statement
This commit is contained in:
nvrl committed 2026-10-02 19:34:45 +02:00
1 parent 4027ab5fb3
commit ff362d0d08
5 files changed
+441 -116

No files matched your search

+15
View File
@@ -99,7 +99,21 @@ impl Role {
/// Install a real CJK fallback before the default egui fonts. egui ships a
/// compact Latin font, but it intentionally does not bundle the multi-megabyte
/// CJK families. Native desktops already provide one, so use it when present.
///
/// On a thread of its own: `fc-match` and reading a font file of tens of
/// megabytes held the first frame back by a visible moment, and every name
/// that needs the fallback is still loading from the catalog by then anyway.
pub fn install_font_fallbacks(ctx: &egui::Context) {
let ctx = ctx.clone();
let spawned = std::thread::Builder::new()
.name("fonts".into())
.spawn(move || install_cjk_fallback(&ctx));
if let Err(error) = spawned {
tracing::debug!("font fallback thread: {error}");
}
}
fn install_cjk_fallback(ctx: &egui::Context) {
let Some((path, index)) = system_cjk_font() else {
return;
};
@@ -116,6 +130,7 @@ pub fn install_font_fallbacks(ctx: &egui::Context) {
fonts.families.entry(family).or_default().push(name.clone());
}
ctx.set_fonts(fonts);
ctx.request_repaint();
}
#[cfg(target_os = "linux")]