Performance of DynamicMap vs Panel (param.Parameterized)

I was displaying a rasterized Trimesh on a tile background and using the Panel approach I am returning an overlay. I added a time slider for displaying the changing ‘z’ values on the Trimesh and the resulting animation flickered the screen as it updated.

I repeated the same with a DynamicMap approach and kept the tiles overlay out of the rasterized DynamicMap and the result was much smoother and faster.

Is this expected or is there a way to do the same in the param.Parameterized class approach that I was using? Or should I combine the two approaches by keeping some controls in the param.Parameterized and using DynamicMap . Advice please. Thanks

1 Like

The DynamicMap approach is always going to be more optimized than using Panel param support since HoloViews automatically figures out a minimal diff to apply to the plot while Panel+Param generally triggers a full re-render of the plot. You can in fact use the exact syntax for both however, e.g. this is valid (pseudo-code):

def some_method(self):
    return some_holoviews_object

tiles * hv.DynamicMap(self.some_method)

So the best approach is to mix and match the two approaches as needed. I’m hoping to add a performance guide to the Panel docs in the near future which will have a section about HoloViews and DynamicMap.


@philippjfr That would be great. Also I see for customizing DynamicMap widgets and so combining them is probably a best practice.

@philippjfr I recently found this interesting issue

which lead me this PR that has been merged

I have used the above strategy and found that it has best of both worlds i.e. performance of DynamicMap and widget selection from panel. Am I missing something or should this be a best practice when building dashboards ?

1 Like

Totally agree that the use of DynamicMap should be documented and exemplified in Panel.

1 Like