Skip to content

Worse performance using datashader? #296

Closed

Description

@LucaMarconato

I wrote some benchmarks available here #295 (they can simply run as tests) and I have noticed that the datashader performance is worse than the matplotlib based one.

I think this maybe be due to the size of the canvas used by datashader since in the MERFISH example here #243 the performance was (as expected) better.

Therefore using a smaller default canvas size may fixed the issue. @Sonja-Stockhaus could you please have a look into this?

Activity

  1. LucaMarconato commented on Jul 13, 2024

    @LucaMarconato
    MemberAuthor

    Here are the results of a (single) run of the tests (the timing are consistent across multiple manual runs).

    image
  2. LucaMarconato commented on Jul 13, 2024

    @LucaMarconato
    MemberAuthor

    With the fix that I proposed to the performance bug here #297 the performance gap is much bigger

    image
  3. timtreis commented on Jul 14, 2024

    @timtreis
    Member

    @Sonja-Stockhaus my "didn't-look-at-the-code" theory is that datashader generates too large of an image which then bypasses the rasterisation-downsampling logic. Wdyt?

  4. Sonja-Stockhaus commented on Jul 15, 2024

    @Sonja-Stockhaus
    Collaborator

    Yep, datashader generates an image that is exactly the size of the extent (large extent = large image = long runtime). I'll think of sth so that we can use a smaller canvas size and then maybe rasterize or so to bring it back to the original scale.
    Do we want a heuristic again to decide on the "smaller canvas size"?

    I also noticed that for datashader, e.g. the radius of the points is relative to the axes which is not the case for matplotlib. So for a large extent you need extremely large point sizes to even make them visible at all with datashader. That should be consistent with matplotlib.

  5. LucaMarconato commented on Jul 16, 2024

    @LucaMarconato
    MemberAuthor

    Thanks for the explanation. I would reuse the logic of _rasterize_if_necessary() or _multiscale_to_spatial_image() to take the dpi of the figure and the fig_size into consideration, since the extent could be extremely large, but in the end we are limited by the pixels available on screen/paper for plotting.

  6. LucaMarconato commented on Jul 16, 2024

    @LucaMarconato
    MemberAuthor

    Btw, off-topic comment, when plotting Visium HD data as points/circles I noticed a Moire pattern due to the presence of a small rotation in the raw data. With datashader rasterization the Moire pattern disappears, which is great! So using datashader could have also this nice use case beyond improved performance.

  7. linked a pull request that will close this issuedatashader speedup and bugfixes #309on Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions