Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to check performance #23

Merged
merged 3 commits into from
Nov 26, 2020
Merged

Add script to check performance #23

merged 3 commits into from
Nov 26, 2020

Conversation

almarklein
Copy link
Collaborator

@almarklein almarklein commented Nov 24, 2020

I was looking for ways to improve the performance of the slicer, and decided to do a bit of benchmarking. This adds a script to test the performance of updating an image with Plotly+Dash.

It contains a dcc.Interval that tries to update a figure as fast as it can. The time it costs to do this will slow the interval down, so we can measure fps. Of course this FPS value depends on a lot of factors, but it's valuable to see the differences between methods.

Some observations:

  • Even if the (client-side) callback yields no_update, the FPS does not go beyond 20. Not sure whether this is some rate limit or some overhead in Dash.
  • When the callback returns an empty figure, the FPS is the same as doing noting, so that's good.
  • Heatmap is slow! (about 6-7 FPS for me).
  • The gl heatmap is only a wee bit faster (8 FPS). This makes no sense to me ...
  • The PNG approach (which we now use) is actually pretty fast! (13-14 FPS). It actually looks a lot faster than what I experience with the slicer, so we might gain performance by having a good look at the slicer internals.
  • The PNG approach that does not swap the y-axis grinds to a mere 6 FPS. I'd love to get this fixed ...

In summary, I had hoped the glheatmap would allow us to get more smooth interaction. Alas. On the plus side, we seem to have some internal overhead that we can hopefully fix to make things more smooth!

@emmanuelle
Copy link
Contributor

emmanuelle commented Nov 25, 2020

A question about serialization: did you compute the JSON serialization time of the figure? If it's a significant fraction of the time it might explain why the difference between heatmap and heatmapgl is not huge. (and are you using plotly 4.13 which should reduce the serialization time for Heatmap and Heatmapgl ?)

Update: forget what I wrote, since the callback is clientside probably there is no serialization

@emmanuelle
Copy link
Contributor

I tried the same benchmark on larger (256x512x512) and random uint8 (worst case for png compresseion) data and

  • png: 8-9 fps
  • heatmap 1 fps
  • heatmapgl: 3-4 fps
  • png not reversed: 1 fps :-(

@emmanuelle
Copy link
Contributor

Note that the performace of the noop and empty modes are improved when setting the update_title of the app to None:

app = dash.Dash(__name__, update_title=None)

also see https://dash.plotly.com/external-resources. I think this also slightly improves the png mode.

@almarklein
Copy link
Collaborator Author

I added update_title=None. I'm surprised at how much this improves the performance ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants