Closed nsherry4 closed 5 years ago
Selection Masks turned out to be really slow because while they require a buffer (so that the pixels can be directly altered), the selection mask object was being discarded after every rendering, rather than saved like the ones to draw the actual maps. This issue is addressed in commit ec5dfb9527f3f5344c05e18ab27574254e074a43
Selection Masks further don't draw anything now if there is no selection. Previously it would still compose a transparent selection layer onto the drawing when the selection was empty.
GridPerspective getXYFromIndex was heavily used in Cyclops' MapPainter::transformDataForMap method. getXYFromIndex returned a Pair<Integer, Integer>, and every time one of these was constructed to return an x,y pair, it would incur a penalty from autoboxing the ints to Integers. Creating an IntPair class to act like a Pair<Integer, Integer> helped speed this method up drastically.
Calculating the max intensity required summing all maps and taking the max. This was done every time the map was redrawn. MapFilteringController now caches the summed map to speed this process up.
Performance of drawing large maps has now substantially improved. Unless there is a user request for even better performance, I'm going to consider this issue resolved.
Maps on the order of 1000x1000 take several seconds to render. We can mitigate this issue with #133 but speeding up the actual drawing would help too, especially since larger maps seem to be becoming more common.