plotly / dash-slicer

A volume slicer for Dash
https://dash.plotly.com/slicer
MIT License
24 stars 7 forks source link

Improve performance #26

Closed almarklein closed 3 years ago

almarklein commented 3 years ago

Last time I totally overlooked the effect of debug mode on the performance. The benchmarks perform much better now :)

I also saw that with debug mode there seems to be quite some added overhead per callback, even if that callback just passes a value from an input to an output.

The debug feature most responsible for the performance penalty here seems to be dev_tools_props_check, so you can also disable that, and still benefit from other debug features 🚀

Running tests/performance1.py now gives me:

emmanuelle commented 3 years ago

Ha very interesting! The future doc should suggest to turn off debug to increase performance.

almarklein commented 3 years ago

It was mostly the props check that made things slow, so running with debug=True, but adding dev_tools_props_check=False is fine!

almarklein commented 3 years ago

I also changed tests/performance2.py a bit to get slider.value -> index.data -> trace.data -> figure. This is more similar to what we have in the slicer. I found out that creating the trace separately and storing it in a store caused the big performance difference that I was still seeing.