Problem
Two AppKit view controllers create brand new cell views on every reload instead of using the standard makeView(withIdentifier:owner:) cell reuse pattern:
SidebarOutlineViewController (710 lines)
makeProjectCell, makeWorktreeCell, makeAgentCell (lines 272-397) create fresh NSTableCellView + NSStackView instances every time outlineView(_:viewFor:item:) is called
rebuildNodes is called from updateNSViewController which fires on every SwiftUI state change, creating allocation pressure
CommandPaletteViewController (~640 lines)
tableView(_:viewFor:row:) (lines 667-717) creates new cells every call
filterVariants calls reloadData() on every keystroke, so typing creates new views for every filtered result on every character
Impact
Without cell reuse:
- Scrolling or frequent reloads allocate and discard many views
- GC pressure increases with more items
- Performance degrades with larger lists
Suggested approach
- Register cell identifiers for each cell type
- Use
makeView(withIdentifier:owner:) to reuse cells
- Configure the reused cell's content instead of rebuilding the view hierarchy
Files
apps/purepoint-macos/purepoint-macos/Views/Sidebar/SidebarOutlineViewController.swift
apps/purepoint-macos/purepoint-macos/Views/CommandPalette/CommandPalettePanel.swift
Problem
Two AppKit view controllers create brand new cell views on every reload instead of using the standard
makeView(withIdentifier:owner:)cell reuse pattern:SidebarOutlineViewController (710 lines)
makeProjectCell,makeWorktreeCell,makeAgentCell(lines 272-397) create freshNSTableCellView+NSStackViewinstances every timeoutlineView(_:viewFor:item:)is calledrebuildNodesis called fromupdateNSViewControllerwhich fires on every SwiftUI state change, creating allocation pressureCommandPaletteViewController (~640 lines)
tableView(_:viewFor:row:)(lines 667-717) creates new cells every callfilterVariantscallsreloadData()on every keystroke, so typing creates new views for every filtered result on every characterImpact
Without cell reuse:
Suggested approach
makeView(withIdentifier:owner:)to reuse cellsFiles
apps/purepoint-macos/purepoint-macos/Views/Sidebar/SidebarOutlineViewController.swiftapps/purepoint-macos/purepoint-macos/Views/CommandPalette/CommandPalettePanel.swift