Skip to content

fix: replace O(n²) linear scans with O(1) Map lookups in getUserActiv…#7

Merged
aikenahac merged 1 commit into
masterfrom
claude/fix-performance-issue-MXNio
May 6, 2026
Merged

fix: replace O(n²) linear scans with O(1) Map lookups in getUserActiv…#7
aikenahac merged 1 commit into
masterfrom
claude/fix-performance-issue-MXNio

Conversation

@aikenahac
Copy link
Copy Markdown
Owner

@aikenahac aikenahac commented May 5, 2026

getUserActivityData() was calling .find() on four arrays and .filter() on a fifth inside a .map() over up to 500 users, producing O(users × entries) CPU usage that scaled catastrophically. Pre-index each result array into a Map keyed by userId so every per-user lookup is O(1).

…ityData

getUserActivityData() was calling .find() on four arrays and .filter() on a
fifth inside a .map() over up to 500 users, producing O(users × entries)
CPU usage that scaled catastrophically. Pre-index each result array into a
Map keyed by userId so every per-user lookup is O(1).

https://claude.ai/code/session_01R9UxmCEUgGCK58iJpMhuBY
@aikenahac aikenahac merged commit ba7363e into master May 6, 2026
2 of 3 checks passed
@aikenahac aikenahac deleted the claude/fix-performance-issue-MXNio branch May 6, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants