Skip to content

perf(remediation): replace linear packages.find() with Map lookup for O(1) access#653

Merged
sonukapoor merged 1 commit into
mainfrom
perf/issue-645-map-based-lookup
Jun 14, 2026
Merged

perf(remediation): replace linear packages.find() with Map lookup for O(1) access#653
sonukapoor merged 1 commit into
mainfrom
perf/issue-645-map-based-lookup

Conversation

@sonukapoor

Copy link
Copy Markdown
Collaborator

Replace O(n) linear packages.find() scans with O(1) Map lookups in the transitive remediation and parent-upgrade functions.

Before: packages.find(p => p.name === name) on every call — O(n) per lookup
After: Pre-built Map<string, PackageRef> — O(1) per lookup

Refs #645

@sonukapoor sonukapoor force-pushed the perf/issue-645-map-based-lookup branch from 99ba6f9 to 263f6ad Compare June 14, 2026 15:15
@sonukapoor sonukapoor merged commit 75c82e9 into main Jun 14, 2026
6 checks passed
@sonukapoor sonukapoor deleted the perf/issue-645-map-based-lookup branch June 14, 2026 15:33
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.

1 participant