das-developers / das2java

The original das2 library. Provides interactive publication-ready 2-D plotting
https://das2.org
GNU Lesser General Public License v3.0
4 stars 0 forks source link

DataGeneralPathBuilder optimizations should begin #26

Open jbfaden opened 2 years ago

jbfaden commented 2 years ago

Sadie pointed out a data set that performs horribly with the SeriesRenderer, where it was about 40,000 points, plotted on a log Y axis, and there are many zeros which end up plotting at -10000. It appears that the graphics engine is painting a bunch of stuff that's off screen, because when I limit the distance to just off screen performance is dramatically improved. The data is fed into a newer class (2017) called the DataGeneralPathBuilder, which manages the pen location and up/down motions.

This does point out that it might be a good time to start introducing some optimizations, however. For example, the three co-linear points could be drawn as one line segment, and reasonable approximations for co-linear would make this happen often. The "Huge Scatter" renderer in Autoplot would keep track of the min and max within a column of pixels and draw one segment. This has the virtue of scaling to any size data set, because the complexity is limited by screen resolution, not the number of data points.

Likewise, nice optimizations can be made for tiny and indistinguishable movements within a pixel which can be collapsed.

jbfaden commented 2 years ago

Last, there's an issue with the bias towards time series causing strange breaks in the data. I've been commenting on this today on another tracker, and this might be dealt with at the same time. (https://sourceforge.net/p/autoplot/bugs/1582/)

jbfaden commented 2 years ago

I verified that for https://github.com/autoplot/dev/blob/master/bugs/2022/20220125/clipDashedLine.jy a 0 plotted in log space results in a trace which decends to -10000 px, which causes things to be very slow.

I found an experimental branch where the path drawn by the SeriesRenderer would be clipped to just the visible parts. This wasn't quite fully tested, but the one unsupported branch is finished and I've run the nightly tests against it. See GraphUtil.clipPath, which is now enabled by default.