hafen / trelliscopejs

TrelliscopeJS R Package
https://hafen.github.io/trelliscopejs
Other
263 stars 37 forks source link

Parallel rendering of panels #6

Open hafen opened 7 years ago

hafen commented 7 years ago

Provide the option for parallel rendering of panels. For this, to retain progress bars, we may need to look into pbapply (https://github.com/psolymos/pbapply) since it can do progress bars for parallel.

colinbrislawn commented 7 years ago

Yes please. 🙏

writing panels       [=---------]   6% 184/3075 eta:11m
hafen commented 7 years ago

To provide some additional discussion on this, since the purrr family of map functions is used, any updates to purrr to provide parallel computation would be automatically leveraged here.

I am working on functionality right now that will allow you to defer the computation of the panels until they are requested by the trelliscope viewer. This would make your initial display creation nearly instantaneous, but it could take some more time to get individual panels when viewing. It will use a cache to not re-render panels that have already been requested. However, this approach has the downside that without pre-generating all the panels, you have to have R running as a server in the background, making it more difficult to deploy the display for others to view. I'll make an announcement when this is up.

In the mean time, I presume in the output above you are using ggplot2? I've found that when feasible using a different graphics system can sometimes result in an order of magnitude faster rendering time. Usually the speed of ggplot2 is not an issue (when creating a single plot) but it really starts to be noticeable when making a lot of plots.

colinbrislawn commented 7 years ago

Thanks for the update. I look forward to this option.

The original trelliscope packages does just-in-time graphing really well. I really like that trelliscopejs makes stand-alone graphs without an R server; in my mind, this is one way it differentiates itself from the previous version of trelliscope.

I am indeed using ggplot2. Good guess! I also tried your package rbokeh, which 10x faster on the same dataset. Any suggestions on other fast graphing packages that do all their rendering in the browser?

hafen commented 7 years ago

For general-purpose plotting, besides rbokeh there is plotly and a few others. I haven't done a comparison of speed on these, but I would assume it's comparable.