perf: reduce library pages on low memory devices

This commit is contained in:
mARTin-B78 2026-09-04 08:35:18 +02:00
parent 4ffe6e9012
commit cb653d15d0
5 changed files with 8 additions and 5 deletions

View File

@ -57,6 +57,8 @@ Follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · versioned wi
preventing repeated clicks from issuing duplicate LLM casting requests.
- **Image Job Cancellation.** Consistent profile/reference jobs now expose a cooperative cancellation endpoint and
progress-panel Cancel control; queued work can be cancelled without interrupting unrelated ComfyUI jobs.
- **Low-Memory Table Mode.** Character and voice-library pages now render 25 rows at a time on devices reporting
approximately 4 GB RAM or less, while images remain lazy-loaded.
- **Preview Blob Lifecycle.** Character-library and Rehearser local voice previews now revoke replaced or completed
object URLs, reducing retained browser memory during repeated auditioning.
- **Character Library Smoke Coverage.** Added deterministic browser coverage for opening Characters / Cast, profile

View File

@ -115,7 +115,8 @@ the first block before investing in architecture or polish.
- [x] Revoke discarded object URLs with `URL.revokeObjectURL(objectUrl)`; completed synthesized voice previews and
character/Rehearser local auditions now release their Blob URLs when playback ends or is replaced.
- [x] Add low-memory mode using `navigator.deviceMemory` where available; shared worker pools cap at two tasks on devices reporting approximately 4 GB RAM or less.
- [ ] Disable image preloading and reduce table/cache sizes on devices with approximately 4 GB RAM.
- [x] Disable image preloading and reduce table/cache sizes on devices with approximately 4 GB RAM. Images use
lazy decoding, and character/voice pages reduce from 50 to 25 rows when `navigator.deviceMemory <= 4`.
## P1 — Backend stability and bounded concurrency

File diff suppressed because one or more lines are too long

View File

@ -186,7 +186,7 @@ async function libraryRenderCharacters() {
// memory for sorting, relationship lookups and bulk operations, while
// only one 50-row page is put into the DOM at a time.
const pageKey = 'ttsvc_libchars_page::' + book;
const pageSize = 50;
const pageSize = typeof window.ttvcIsLowMemoryDevice === 'function' && window.ttvcIsLowMemoryDevice() ? 25 : 50;
const requestedPage = Math.max(1, parseInt(localStorage.getItem(pageKey) || '1', 10) || 1);
const visibleCount = Math.min(chars.length, requestedPage * pageSize);
const visibleChars = chars.slice(0, visibleCount);

View File

@ -1827,7 +1827,7 @@ function renderVoiceList() {
window._voicePage = 1;
}
const totalFiltered = filtered.length;
const pageSize = 50;
const pageSize = typeof window.ttvcIsLowMemoryDevice === 'function' && window.ttvcIsLowMemoryDevice() ? 25 : 50;
const page = Math.max(1, Number(window._voicePage) || 1);
const pageEnd = Math.min(totalFiltered, page * pageSize);
const pageItems = filtered.slice(0, pageEnd);