-
Notifications
You must be signed in to change notification settings - Fork 0
β‘ Bolt: Optimize schedule filtering with Set lookup #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,3 +17,13 @@ | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| **Learning:** When attempting to optimize an O(N^2) array spread operation (`[...existing, talk]`) inside a grouping loop in `groupTalksByTrack`, the purely functional/immutable constraint specified by the team (and the lack of `Map.groupBy` support in Node 20.x Jest environments) means that we must fall back to immutable reductions. | ||||||||||||||||||||||||
| **Action:** When constraints require strict immutability without mutation of objects, use `reduce` with object and array spreads (e.g., `{ ...acc, [key]: [...(acc[key] || []), item] }`) even if it introduces O(N^2) overhead for large arrays. Avoid using `push()` or modifying accumulators directly. Always run Prettier/formatting checks before merge to resolve CI failures. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## 2026-05-03 - Array filtering with repeated includes() | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| **Learning:** Found an O(N\*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a function on every re-render or schedule update. | ||||||||||||||||||||||||
| **Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## 2026-03-24 - Array filtering with repeated includes() | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| **Learning:** Found an O(N\*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update. | ||||||||||||||||||||||||
| **Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling. | ||||||||||||||||||||||||
|
Comment on lines
+21
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the duplicate entry and fix the truncated description. Lines 20β22 and 23β25 are two near-identical sections with the same title. The 2026-05-03 entry (line 21) has an incomplete Learning string β the word π Proposed fix-## 2026-05-03 - Array filtering with repeated includes()
-**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a function on every re-render or schedule update.
-**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
-## 2026-03-24 - Array filtering with repeated includes()
-**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update.
-**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
+
+## 2026-05-03 - Array filtering with repeated includes()
+
+**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update.
+**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entries for 'Array filtering with repeated includes()' are duplicated. The first entry (lines 20-22) also contains a typo where the function name is missing ('inside a function'). It is recommended to remove the redundancy and keep the more accurate entry.