[HIGH] Replace O(n) .find() linear scans with Map lookups in database.ts #36
Labels
No labels
blocked:needs-human
blocked:verify-failed
bug
feature-request
quickfix
security/high
security/medium
test-coverage
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/subvault#36
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Locations:
backend/src/database.tsacrossgetUserById,getSubscriptionById, etc.Problem: All lookups use
.find()on arrays, which is O(n). Combined with the full-file reads on every call, this compounds the performance problem.Impact: Linear scan becomes a bottleneck as user/subscription count grows.
Fix: Build
Map<string, User>keyed byidand byemailat startup; update on mutations. O(n) → O(1).Effort: Included in CRITICAL database cache fix