jrckln / Bendyourspline

2 stars 0 forks source link

Dynamic UI elements #2

Closed matherealize closed 3 years ago

matherealize commented 3 years ago

This is concerned with laggy ui due to dynamic / reactive elements (like sliders created for spline knots). Just an idea to look into.

In Wickham's shiny book, chapter on dynamic UI he mentions a technique to deal with dynamic ui elements. In short, he says that creating and destroying ui elements is slower than hiding and unhiding elements (ie creating them all at once and then requesting them from the server whenever necessary). It also seems to keep values, instead of deleting them each time.

Maybe we could do something similar for the spline tab? So far, as I understand it we are creating and destroying elements every time (insertUI / removeUI) and this might add to laggy UI.

jrckln commented 3 years ago

This is a possibility but we would need to create a tab for each value of number of knots with the same logic behind it. We can definitely try it as it is just copy paste work but I doubt it will improve. I don't think that the reactive UI elements are responsible for this but rather the creation of splines and plotting with plotly. I tried the package profvis to see how R spends its time and its seems like the majority of time is spent to generate the B-spline basis matrix

matherealize commented 3 years ago

As discussed today, the dynamic ui construction is likely is not a big issue. I leave the issue open for now so we don't forget about the possibility, but probably no further action is necessary.

matherealize commented 3 years ago

I'll close for now, as the layout is more defined now and doesn't require the use of dynamic elements anymore.