The regression suite selects the way the band does — defaultsSoleMember: false, and the budget's arithmetic told straight

This commit is contained in:
2026-08-07 15:57:23 -04:00
parent 9c857ae0cc
commit 56e37be158
+6 -6
View File
@@ -172,14 +172,14 @@ struct MarqueeRenderCostTests {
let swept = Set((0..<10).map { ItemID(rawValue: cardName(1, $0)) })
// First select: the legitimate change. Not measured here.
store.select(swept, in: .board, anchor: nil, head: nil)
store.select(swept, in: .board, anchor: nil, head: nil, defaultsSoleMember: false)
board.settle()
let samples = 30
BoardRenderMetrics.reset()
let t0 = CACurrentMediaTime()
for _ in 0..<samples {
store.select(swept, in: .board, anchor: nil, head: nil)
store.select(swept, in: .board, anchor: nil, head: nil, defaultsSoleMember: false)
board.settleOnce()
}
let elapsed = (CACurrentMediaTime() - t0) * 1000
@@ -210,14 +210,14 @@ struct MarqueeRenderCostTests {
let samples = 20
var swept: Set<ItemID> = [ItemID(rawValue: cardName(1, 0))]
store.select(swept, in: .board, anchor: nil, head: nil)
store.select(swept, in: .board, anchor: nil, head: nil, defaultsSoleMember: false)
board.settle()
BoardRenderMetrics.reset()
let t0 = CACurrentMediaTime()
for i in 1...samples {
swept.insert(ItemID(rawValue: cardName(1, i % cardsPerLane)))
store.select(swept, in: .board, anchor: nil, head: nil)
store.select(swept, in: .board, anchor: nil, head: nil, defaultsSoleMember: false)
board.settleOnce()
}
let elapsed = (CACurrentMediaTime() - t0) * 1000
@@ -242,8 +242,8 @@ struct MarqueeRenderCostTests {
//
// That is the shape the fix bought: the cost follows what the user has selected, not what the
// board holds. Before it, every sample re-ran all \(laneCount * cardsPerLane) faces on the
// board whatever the band had swept 3,600 bodies over this stream, an order of magnitude
// over the budget below and independent of the selection entirely.
// board whatever the band had swept 3,600 bodies over this stream, five times the budget
// below and independent of the selection entirely.
//
// The ×3 is `BoardRenderPerformanceTests`' slack rationale: SwiftUI evaluates a body more
// than once per update, so a changed face is worth more than one count. Measured at exactly