Reuse the face grid's decoded crops across a redraw

A confirm or a reject changes one row and redraws the whole grid, and the
redraw re-read every crop blob of the selected person (4 MB for the
largest) and decoded every one — 316 ms per click on the reference
library's 754-face person, to arrive at the pixels already on screen.

`load_faces` now takes the crops the previous load decoded, keyed by face,
and moves each into its new cell; the blob read is skipped when every face
is already in hand. `refresh` drains the old cells into it rather than
cloning them. The redraw is 2.6 ms.
This commit is contained in:
2026-09-20 10:56:36 +02:00
parent e0e193efb4
commit 97a854833d
4 changed files with 53 additions and 11 deletions
+11 -2
View File
@@ -60,8 +60,17 @@ fn main() {
time("load_people", 5, || {
identity::load_people(&catalog, MODEL_ID).unwrap();
});
time("load_faces (largest person)", 5, || {
identity::load_faces(&catalog, &store, biggest).unwrap();
time("load_faces (largest person, cold)", 5, || {
identity::load_faces(&catalog, &store, biggest, Default::default()).unwrap();
});
// What a confirm click costs: the grid's own crops handed back in.
let mut cells = identity::load_faces(&catalog, &store, biggest, Default::default()).unwrap();
time("load_faces (largest person, redraw)", 5, || {
let cut = cells
.drain(..)
.filter_map(|c| Some((c.face, c.crop?)))
.collect();
cells = identity::load_faces(&catalog, &store, biggest, cut).unwrap();
});
time("audit (coverage line)", 5, || {
dr_ui::faces::audit(&catalog, &store, MODEL_ID, &registry).unwrap();