Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@
## 2024-05-18 - Replacing O(N) array search inside nested loops with O(1) object properties
**Learning:** During test optimizations, filtering candidate lists (like available tanks or healers) inside a heavy iterative loop using O(N) array checks (e.g. `Array.some()`) creates a severe performance bottleneck.
**Action:** When filtering or excluding object references inside hot paths, prefer using inherent O(1) boolean properties on the object itself rather than building and parsing sub-arrays to check role inclusion.

## 2026-07-09 - [Early Loop Termination for Score Search]
**Learning:** In optimization passes or matching passes that score candidates (like `grabNextAvailablePlayer` in group creation), the algorithm can find a "perfect" or optimal zero-penalty match (`score === 0`). Failing to break out of the loop at this point leads to unnecessary iterations over the entire remaining candidate pool, wasting CPU cycles on a search that cannot mathematically yield a better result.
**Action:** When scanning collections for a minimum/maximum score, always add an early loop termination condition (`break`) if an absolute optimal limit (like `bestScore === 0`) is reached.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/shared/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export {
shortestPath,
parseSeasonPairs,
} from './seasonPairs.js';
export type { SeasonPairs } from './seasonPairs.js';

export { generateInviteCommand } from './inviteCommand.js';

Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/parallelGroupCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ export function createMythicPlusGroups(
if (score < bestScore) {
bestScore = score;
bestPlayer = player;

// ⚡ Bolt Opt: Absolute optimal score reached, skip checking remaining players
if (bestScore === 0) break;
}
}

Expand Down
Loading