Open lindsaypoirier opened 4 years ago
Try unzipping files by default
After some testing, it seems as though it's not the unzipping that's slowing things down, but the loading of the shape file. Not sure if there's any libraries that could speed up shape file reading.
Update:
renderWidget()
that's part of shiny dealing with output$dist_plot
, in which it appears to spend a lot of time converting data types for some kind of JSON formatThis is my interpretation of the profvis profile, however, when I remove the census tracts from the leaflet plot (remove the addPolygons()
call), the app is fast again (in line with @lindsaypoirier's original observation of the census tracts being the issue.)
Possible next steps:
renderWidget()
is taking so long (I hesitate, because I can't find anyone experiencing similar issues on this specific front, at least on a cursory search)rmapshaper::ms_simplify
to simplify the polygons, and that may be a marginal performance tweak to include laterHere's an annotated screenshot of my app profvis profile:
If interested, I'd recommend running profiles on your machine (or the server); (removing the tidyverse piping
%>%
from the plotting helped for clarity in the profvis output, too.)
Update: during Tues meeting, Ben to post on RStudio Community
Swapping between states is currently quite slow because the all of the census tract shapefiles are not set up load by default, but instead are set up to be unzipped and extracted when a new state is selected.
See comments in the server function for more detail on how this is working.
I'm not sure this is the most efficient way to do things. So any help with speeding this up would be appreciated.