NetLogo / Galapagos

NetLogo model simulation visualizer (Beak) and the netlogoweb.org website 🐢
https://netlogoweb.org/
Other
62 stars 42 forks source link

Enable Highcharts Boost module for all line plots #410

Open LaCuneta opened 1 year ago

LaCuneta commented 1 year ago

After a report of some performance issues with certain plots in NetLogo Web, I traced the issue back to Highcharts redrawing the whole series each time the chart is redrawn. When drawing "regular" graphs that always append along the x-axis the render speed stays pretty fast so isn't noticeable in NetLogo until you get into thousands of ticks worth of points. If you do a true scatter plot or other plot that bounces back and forth along the x-axis, the render time degrades much more quickly, taking over a second at maybe ~500-ish ticks worth of points. That obviously greatly degrades model runtimes.

I checked with the Highcharts people and everything is working as expected from their end. They just don't usually have people who need to do "live" updates many times per second like we do.

Highcharts does have a Boost module that's easy to load that switches from SVG rendering to WebGL rendering. It does greatly speed up the render time. But! It can only render lines that are 1 pixel thick. We use 2 pixel thick lines. This is a known issue that they promise to address at some point, but the GitHub issue has been open for years already. I tested out 1 pixel lines and with light colors, they are very hard to see in the NetLogo Web interface.

So our workaround is to enable the Boost module for scatter plots or back-tracking line plots that are likely to encounter the worst slowdown. We'll then monitor the Highcharts issue and we can remove the workaround and enable Boost for all line plots if that ever gets resolved.

LaCuneta commented 3 months ago

The Highcharts issue is now marked closed, so this issue would be worth revisiting once the fixed code is released.