# TiviLux Native v0.4.18 — Performance Report

## What changed

### 1. Large-library search
**Before:** each query evaluation flattened loaded catalogs, de-duplicated entries, lower-cased every candidate title, scanned matches, and materialized results. That work scales directly with the number of loaded titles and could occur while the user was actively typing.

**After:** a reusable `SearchIndexEntry` list stores each unique item with a normalized title. Query changes are debounced, obsolete jobs are cancelled, index creation/search runs on `Dispatchers.Default`, and results are capped without globally sorting the library.

**Expected impact:** lower main-thread CPU during search and much less repeated allocation/lowercasing on 30k+ Movie / 9k+ Series libraries.

### 2. Playback progress lookup
**Before:** `PlaybackStore.progress()` called `all(profileId)`, which read and parsed the whole persisted JSON list before searching for one item. Series detail requests progress for visible episode rows, so this repeated parsing in a latency-sensitive screen.

**After:** progress JSON is parsed once per profile into an in-memory newest-first list plus media-key map. Normal episode progress lookup is O(1) map access. Writes update cache and persistent storage together.

**Expected impact:** substantially less JSON allocation/parsing during Series browsing and Home/Continue Watching recomposition, while preserving profile isolation and the same persistent format.

### 3. Guide focus scrolling
**Before:** every focused-index change computed a new centered first row and called `scrollToItem()`, even when focus was already in a comfortable part of the viewport.

**After:** a center-safe zone allows natural focus movement and only scrolls when focus crosses the safe threshold near an edge.

**Expected impact:** fewer list scroll operations/re-layout requests while holding D-pad UP/DOWN, less visual jumping, and more natural premium navigation.

### 4. VOD seek bursts
**Before:** each ±30s keypress used the player's current position. ExoPlayer position updates are asynchronous, so very fast repeated presses could visually say +90s while one or more seeks had not yet been reflected in `currentPosition`.

**After:** a burst captures one base position and calculates each target from base + accumulated seconds. Visual feedback and actual seek target use the same accumulator.

**Expected impact:** deterministic rapid remote transport and closer agreement between the UI and actual playback position.

### 5. Series detail viewport
**Before:** hero/backdrop and episode card heights were fixed.

**After:** hero, backdrop, poster, and episode-row heights adapt to available TV height. Short/overscanned layouts receive a smaller hero, while full-size layouts retain the cinematic presentation. Resume entries also show remaining minutes and a progress bar.

**Expected impact:** more useful episode browsing space without throwing away the premium Series identity.

## Already-good architecture left intact
The attached v0.4.17 source already contains several important optimizations and they were intentionally preserved instead of replaced: shared Live player/surface, Guide LazyColumn/stable IDs, delayed EPG work, segmented startup caches, provider no-shrink catalog protection, category repair, Coil image cache, Sports indexes, Media3 decoder fallback, and background refresh scheduling.

## What was NOT claimed
No FPS percentage, startup-millisecond figure, RAM figure, or tune-time percentage is claimed because this environment cannot run Android Studio/System Trace/JankStats on an ONN/Firestick/Shield. Those measurements should be taken on the final signed APK using the real provider and device hardware.
