OpenRA/OpenRA — pull request #6996 by RoosterDragon (2014-11-24 01:13:22+00:00)
Title: Speed up ShroudRenderer.UpdateShroud.

Testing for shrouded/fogged tiles requires GetEdges to run the isVisible delegate 9 times per cell. This delegate can be fairly cheap or somewhat expensive. As a result, it's faster to test visibility for tiles in the region ahead of time and cache the results - this means the delegate is only run 1 time per cell instead of 9. The GetEdges method can then perform its 9 way checks against the array which is far less costly. This makes UpdateShroud about 2x as fast overall.

I observed CPU usage for UpdateShroud drop from 6.4% to 3.1% of all time spent in some profiling I ran.