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:
@@ -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, ®istry).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user