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)) }) let swept = Set((0..<10).map { ItemID(rawValue: cardName(1, $0)) })
// First select: the legitimate change. Not measured here. // 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() board.settle()
let samples = 30 let samples = 30
BoardRenderMetrics.reset() BoardRenderMetrics.reset()
let t0 = CACurrentMediaTime() let t0 = CACurrentMediaTime()
for _ in 0..<samples { 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() board.settleOnce()
} }
let elapsed = (CACurrentMediaTime() - t0) * 1000 let elapsed = (CACurrentMediaTime() - t0) * 1000
@@ -210,14 +210,14 @@ struct MarqueeRenderCostTests {
let samples = 20 let samples = 20
var swept: Set<ItemID> = [ItemID(rawValue: cardName(1, 0))] 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() board.settle()
BoardRenderMetrics.reset() BoardRenderMetrics.reset()
let t0 = CACurrentMediaTime() let t0 = CACurrentMediaTime()
for i in 1...samples { for i in 1...samples {
swept.insert(ItemID(rawValue: cardName(1, i % cardsPerLane))) 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() board.settleOnce()
} }
let elapsed = (CACurrentMediaTime() - t0) * 1000 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 // 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 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 // board whatever the band had swept 3,600 bodies over this stream, five times the budget
// over the budget below and independent of the selection entirely. // below and independent of the selection entirely.
// //
// The ×3 is `BoardRenderPerformanceTests`' slack rationale: SwiftUI evaluates a body more // 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 // than once per update, so a changed face is worth more than one count. Measured at exactly