perf(scanner): three high-impact speed optimizations #156
No reviewers
Labels
No labels
agent-context-drift
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rstillwell/deckhearth#156
Loading…
Reference in a new issue
No description provided.
Delete branch "perf/scanner-speed-optimizations"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Three targeted optimizations to make the card scanner feel faster on mobile, based on profiling the identify pipeline.
1. Non-blocking scan capture upload
File:
lib/use-scanner-identification.jsemitScannedCard()previouslyawaiteduploadScanCapture()before callingonCardScanned(). This blocked the result display for ~500ms+ (MinIO roundtrip). Now the card result is shown immediately and the upload fires in the background.Impact: ~500ms faster result display for every scanned card.
2. Parallel OCR workers
File:
lib/ocr-worker.jsrecognizeCardFields()ran two sequentialworker.recognize()calls (name strip + number strip) on a single Tesseract worker — the number strip always waited for the name strip to finish. Now two independent workers run in parallel viaPromise.all().Also cleaned up
terminateOcrWorker()to properly tear down both workers.Impact: Layer 1 OCR time cut ~50% on mobile (from ~1.5-3s to ~0.7-1.5s).
3. Faster pre-verification timing
File:
lib/scanner-card-detection.jsVERIFICATION_INTERVAL_MSMIN_FIRST_SEEN_MS_FOR_VERIFYCards now reach the verification pipeline ~300ms faster after first detection.
Impact: ~300ms reduction in auto-detect-to-identify latency.
Test results
All 58 scanner tests pass (2.20s). No behavioral changes to identification logic.