perf(classifier): raise scan concurrency 16 -> 32

The scan is I/O-bound on cloud-sync / network mounts (OneDrive, Samba) where
each directory read is a high-latency round-trip. More in-flight reads hide
that latency on the many-folders case. (A single large folder is still
enumerated one entry at a time by the File System Access API and can't be
parallelized.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZDDC 2026-06-09 14:08:54 -05:00
parent 420f735e89
commit 05fc3b69dd

View file

@ -16,11 +16,15 @@
let scanGen = 0; // bumped per scan; stale workers bail let scanGen = 0; // bumped per scan; stale workers bail
let scanStats = null; // { folders, files, current, done, startedAt } let scanStats = null; // { folders, files, current, done, startedAt }
let renderTimer = null; // throttle for progressive re-render let renderTimer = null; // throttle for progressive re-render
// How many directory reads to keep in flight at once. The scan is // How many directories to read in flight at once. The scan is I/O-bound —
// I/O-bound (each readdir is a network round-trip to the share), so the // each readdir is a round-trip to the backing store (cloud-sync / network
// lever is parallel in-flight reads, not CPU threads — raise this if the // mounts like OneDrive or Samba have high per-op latency), so the lever is
// share tolerates more concurrency. // parallel in-flight reads, not CPU threads. This only helps the
var SCAN_CONCURRENCY = 16; // many-folders case; a single fat folder is enumerated one entry at a time
// by the File System Access API and can't be parallelized. Raise it if the
// store tolerates more concurrency; too high risks cloud-provider
// throttling.
var SCAN_CONCURRENCY = 32;
function scheduleRender() { function scheduleRender() {
if (renderTimer) return; if (renderTimer) return;