Skip to content

Conversation

@dwerner
Copy link
Contributor

@dwerner dwerner commented Dec 5, 2025

No description provided.

Replace Array.find() with Map-based lookups for constant-time allocation
retrieval in both TapCollector and GraphTallyCollector.

This achieves approximately 5000x performance improvement for datasets
with 10k+ RAVs/allocations by eliminating the nested loop that caused
quadratic complexity.

Changes:
- tap-collector.ts: Build allocation map for O(1) lookups
- graph-tally-collector.ts: Build allocation map for O(1) lookups

Based on: #1146
Original author: madumas
Original commit: 59efa95
Replace repeated Array.filter() and Array.find() operations with a
Map-based lookup system for deployment rules.

Changes:
- Add preprocessRules() function to create a Map for O(1) rule lookups
- Update isDeploymentWorthAllocatingTowards() to use preprocessed rules
- Update evaluateDeployments() to preprocess rules once before iteration
- Update matchingRuleExists() in AllocationManager to use optimized lookup

This eliminates quadratic complexity when evaluating thousands of
deployments against hundreds of rules.

Based on: #1147
Original author: madumas
Original commit: 2618f23
Update all package versions to 0.25.1 for the release.
@dwerner
Copy link
Contributor Author

dwerner commented Dec 5, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🗃️ Inbox

Development

Successfully merging this pull request may close these issues.

2 participants