perf(app-store): optimize location option deduplication to O(1) - #29997
perf(app-store): optimize location option deduplication to O(1)#29997webdevsamran wants to merge 1 commit into
Conversation
In getLocationGroupedOptions, deduplicating options per category used apps[groupByCategory].find(...) and array spreading inside loops, resulting in O(N^2) complexity with many credentials/apps. Use a per-category Set to perform O(1) membership checks and push directly to the options array, reducing worst-case complexity to O(N). Fixes calcom#29959
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Welcome to Cal.diy, @webdevsamran! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthrough
Merge Risk: ⚪ Minimal · up to This PR changes location-option deduplication to use constant-time membership checks and direct array insertion, with no actionable merge-blocking risk remaining beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Summary
Fixes #29959
Problem
In \getLocationGroupedOptions\ (\packages/app-store/server.ts), deduplicating options per category used \�pps[groupByCategory].find((o) => o.value === option.value)\ along with array spreading inside loops. When many app credentials exist, this produces repeated (O(N)) linear scans and array allocations resulting in (O(N^2)) execution time.
Fix