Fix compute_fov() O(n²) performance bug - return None instead of cell list #146
Labels
No Label
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: john/McRogueFace#146
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Grid.compute_fov()has O(grid_size) performance instead of O(radius²) due to building a Python list of all visible cells by iterating through the entire grid.Benchmark on 1000×1000 grid:
compute_fov(): 15.76ms (iterates 1M cells)This is a 75x performance penalty from unnecessary list building.
Current Implementation (UIGrid.cpp:1192-1218)
Solution
Change
compute_fov()to returnNone. Users query visibility withis_in_fov(x, y).Implementation
py_compute_fov()Py_Noneinstead ofresult_listNotes
is_in_fov()per-cell as it draws