1c392de0fa
useProgressAutoSave fires saveConfig ~once per second of reading. Two write-time sources were doubling its IPC cost: 1. saveConfig wrote the WHOLE library.json (+ backup) on every call, so a user with N books paid 2*JSON.stringify(N) per save. Chrome DevTools' Bottom-Up profile on a release Android build showed processIpcMessage chewing ~25% of main-thread time during a reading session. 2. nativeFileSystem.writeFile / copyFile defensively called plugin:fs|exists before every write to ensure the parent dir existed. Same dir gets probed once per save -- ~50% of IPC time per save was just exists() round-trips against directories that have been there since the book was opened. Fix: - LIBRARY_SAVE_THROTTLE_MS=30s coalesces a swipe burst into a single library.json write. Per-book config.json is still written eagerly -- it's the sync source-of-truth and is small. flushPendingLibrarySave() is called on hook unmount + window blur so closing the book always flushes. - In-process knownExistingDirs Set caches verified directories per app session. createDir adds, removeDir (incl. recursive) clears. Cold start still does the original exists+createDir dance once per dir.