docs: Studio face group performance optimization handoff
Document for Studio team to implement lazy loading + concurrency increase for face group thumbnail loading. Expected improvement: Charade load time from ~76s to <2s.
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
# Studio Performance Optimization - Face Group Thumbnails
|
||||
|
||||
## Problem
|
||||
|
||||
Loading face groups for large files (e.g., Charade with 153 groups, 2,451 traces) is slow because:
|
||||
1. All thumbnails load immediately on page render
|
||||
2. Thumbnail concurrency is limited to 16 parallel requests
|
||||
3. Each thumbnail requires a separate HTTP request + ffmpeg extraction (~0.5-1s each)
|
||||
|
||||
**Estimated load time before: ~76 seconds**
|
||||
|
||||
## Changes Required
|
||||
|
||||
### 1. Increase Thumbnail Concurrency
|
||||
|
||||
**File:** `src/store.ts`
|
||||
|
||||
```typescript
|
||||
// Line ~327: Change from 16 to 32
|
||||
const MAX_CONCURRENT = 32 // was 16
|
||||
```
|
||||
|
||||
**Effect:** Doubles parallel thumbnail loading capacity.
|
||||
|
||||
---
|
||||
|
||||
### 2. Add Lazy Loading to Face Groups
|
||||
|
||||
**File:** `src/views/PeopleView.vue`
|
||||
|
||||
The `v-observe` directive (IntersectionObserver) is already used for unassigned traces. Apply the same pattern to face groups.
|
||||
|
||||
#### 2a. Main Face Groups Section (~line 53)
|
||||
|
||||
**Before:**
|
||||
```vue
|
||||
<div v-for="c in faceGroups" :key="c.group_uuid" class="ms-ppl-face-card ms-ppl-cluster-card" ...>
|
||||
```
|
||||
|
||||
**After:**
|
||||
```vue
|
||||
<div v-for="c in faceGroups" :key="c.group_uuid" class="ms-ppl-face-card ms-ppl-cluster-card" v-observe="() => { if (c.rep_trace) loadTraceThumb(c.rep_trace) }" ...>
|
||||
```
|
||||
|
||||
#### 2b. Merge Target Modal (~line 303)
|
||||
|
||||
**Before:**
|
||||
```vue
|
||||
<div v-for="c in faceGroups" :key="c.group_uuid" class="ms-merge-face-card" @click="moveToGroup(c)">
|
||||
```
|
||||
|
||||
**After:**
|
||||
```vue
|
||||
<div v-for="c in faceGroups" :key="c.group_uuid" class="ms-merge-face-card" @click="moveToGroup(c)" v-observe="() => { if (c.rep_trace) loadTraceThumb(c.rep_trace) }">
|
||||
```
|
||||
|
||||
#### 2c. Merge Candidate Modal (~line 273)
|
||||
|
||||
**Before:**
|
||||
```vue
|
||||
<div v-for="c in mergeCandidateGroups" :key="c.group_uuid" class="ms-merge-face-card" @click="executeMerge(c.group_uuid)">
|
||||
```
|
||||
|
||||
**After:**
|
||||
```vue
|
||||
<div v-for="c in mergeCandidateGroups" :key="c.group_uuid" class="ms-merge-face-card" @click="executeMerge(c.group_uuid)" v-observe="() => { if (c.rep_trace) loadTraceThumb(c.rep_trace) }">
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## How `v-observe` Works
|
||||
|
||||
The directive is already defined in `src/directives/vObserve.ts`:
|
||||
- Uses `IntersectionObserver` with `rootMargin: '200px 0px'`
|
||||
- Only triggers when element enters viewport (+200px buffer)
|
||||
- Auto-disconnects after first trigger
|
||||
- Falls back to immediate load if element is already visible
|
||||
|
||||
---
|
||||
|
||||
## Expected Results
|
||||
|
||||
| Metric | Before | After |
|
||||
|--------|--------|-------|
|
||||
| Concurrent loads | 16 | **32** |
|
||||
| Initial thumbnails | All 153 | **Only visible (~6-10)** |
|
||||
| Charade load time | ~76s | **<2s** (first screen) |
|
||||
|
||||
---
|
||||
|
||||
## Testing
|
||||
|
||||
1. Open Charade file in PeopleView
|
||||
2. Verify face group thumbnails load as you scroll down
|
||||
3. Verify merge dialogs also lazy-load thumbnails
|
||||
4. Check browser Network tab — thumbnails should not all fire at once
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- `loadTraceThumb` and `faceThumbsCache` are already imported in PeopleView.vue
|
||||
- The `v-observe` directive is already registered globally in `src/main.ts`
|
||||
- No new dependencies required
|
||||
Reference in New Issue
Block a user