[Performance]: Light area calculation is slow for many lights #3342
Labels
feature
Adding functionality that adds value
performance
A performance or quality of life improvement
tested
This issue has been QA tested by someone other than the developer.
Describe the Bug
When loading a map for the first time, the visible area is calculated. This is very slow when many lights are present, with almost of the time being spent combining light areas according lumens.
There seem to be two large factors that cause this the slowdown:
Area
s toPath2D
and back again. This is expensive and we can avoid a lot of this work by only converting back toArea
once all lights have been combined.To Reproduce
Timer ZoneRenderer.renderZone
time since opening the campaign is high. I observed ~40s.Expected Behaviour
The provided map should be able to load in under 10 seconds in the same conditions.
Screenshots
No response
MapTool Info
1.11.4
Desktop
Linux Mint 20.2
Additional Context
Here is the test map: manyLightsTest.zip. Just rename it to
.cmpgn
instead of.zip
once downloaded.Other actions can trigger the a full recomputation of the visible area. E.g., selecting a token and then deselecting it will result in the same ~40s delay.
The text was updated successfully, but these errors were encountered: