fix(client): median-of-5 timing in fog perf test — kills load flake (T-1092)
test_visibility_texture_update_performance asserted a single wall-clock sample against the 0.5ms budget and blocked two pushes while a live session shared the machine (0.704ms / 0.623ms; 46/46 green in isolation). Median of 5 runs preserves the D-059 budget intent while absorbing load spikes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -192,15 +192,21 @@ func test_visibility_texture_update_performance() -> void:
|
||||
# a rare amortized event (8-tile padding), not part of the per-frame budget.
|
||||
fog_state.update_from_state()
|
||||
|
||||
# Measure the steady-state per-frame update (same positions, no resize)
|
||||
var start := Time.get_ticks_usec()
|
||||
fog_state.update_from_state()
|
||||
var elapsed_us := Time.get_ticks_usec() - start
|
||||
var elapsed_ms := elapsed_us / 1000.0
|
||||
# Measure the steady-state per-frame update (same positions, no resize).
|
||||
# Median of 5 runs: a single wall-clock sample flakes when the machine is
|
||||
# loaded (T-1092 — the pre-push gate shares the box with live sessions);
|
||||
# the median keeps the D-059 budget intent while absorbing load spikes.
|
||||
var samples: Array[float] = []
|
||||
for _i in range(5):
|
||||
var start := Time.get_ticks_usec()
|
||||
fog_state.update_from_state()
|
||||
samples.append((Time.get_ticks_usec() - start) / 1000.0)
|
||||
samples.sort()
|
||||
var median_ms: float = samples[2]
|
||||
|
||||
# D-059: Visibility texture upload budget: 0.1ms
|
||||
# Allow margin for test environment overhead
|
||||
assert_that(elapsed_ms).is_less(0.5)
|
||||
assert_that(median_ms).is_less(0.5)
|
||||
|
||||
GameState.visible_positions.clear()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user