perf: UiLayer HashMap → flat Vec array — 62 FPS → 95 FPS
Replaced HashMap<(i32,i32), UiCell> with Vec<Option<UiCell>> indexed by y*width+x. dirty_keys Vec tracks non-None cells for iteration. - set/set_alpha: O(1) array write (was O(1) amortized HashMap insert with hashing overhead) - get: O(1) array index (was HashMap lookup) - keys(): iterate dirty_keys Vec (was HashMap keys iterator) - clear(): memset None over flat array (was HashMap::clear) - resize() called in build_ui to size array to viewport - All 185 tests + 14 scenarios pass - Benchmark: 95.1 FPS (was 61.9 — 53% improvement)
This commit is contained in:
+11
-11
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"mode": "graphics",
|
||||
"ticks": 300,
|
||||
"total_time_ms": 4845.5,
|
||||
"avg_fps": 61.9,
|
||||
"avg_frame_time_ms": 16.12,
|
||||
"p99_frame_time_ms": 145.95,
|
||||
"min_frame_time_ms": 8.19,
|
||||
"total_time_ms": 3153.2,
|
||||
"avg_fps": 95.1,
|
||||
"avg_frame_time_ms": 10.48,
|
||||
"p99_frame_time_ms": 65.20,
|
||||
"min_frame_time_ms": 6.55,
|
||||
"subsystems": {
|
||||
"ca_step_avg_us": 8153,
|
||||
"ca_step_p99_us": 137703,
|
||||
"ca_step_min_us": 1174,
|
||||
"render_avg_us": 4433,
|
||||
"render_p99_us": 6450,
|
||||
"render_min_us": 3956
|
||||
"ca_step_avg_us": 3386,
|
||||
"ca_step_p99_us": 58075,
|
||||
"ca_step_min_us": 231,
|
||||
"render_avg_us": 3770,
|
||||
"render_p99_us": 5334,
|
||||
"render_min_us": 3320
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user