BlueHuskyStudios / BlueHuskyStudios/DeadassSimpleMediaPlayer
`orderedEntries` is O(n²) and recomputed inside `onDelete`'s loop
- Dominant language
- Swift
- Stars
- 0
- Forks
- 3
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 9
Description
```swift
var orderedEntries: [PlaylistEntry] {
session.queue.effectiveOrder.compactMap(session.queue.entry(withID:))
}
```
`entry(withID:)` is a linear scan, so this is O(n²) per evaluation — and it's a computed property read from `body`. For a 500-entry queue that's ~250k UUID comparisons per render.
Worse, `.onDelete` does `offsets.map { orderedEntries[$0].id }`, re-evaluating the whole O(n²) property for **each** offset.
An `[UUID: Entry]` index on `Playlist`, or caching the ordered array, resolves both.
Contributor guide
Research direction
Locate the `orderedEntries` computed property and the `.onDelete` loop that reads it from `body`, then inspect `Playlist` and `entry(withID:)`. Confirm the repeated linear scans during rendering and deletion; done means preserving entry ordering and deletion behavior without recomputing the full lookup for each offset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100