`crop0(sdata).pl.render_labels` running too slow

I am quite a newbie of spatial omics.

We tried running spatialdata using Xenum 5K example data on a lab server(512Gb Mem, 120 thread CPU ,no GPU). The run time was much longer than expected, especially when plotting cropped spatial data.

Here are some examples:

%%time
from spatialdata import bounding_box_query

fig, ax = plt.subplots(1, 1, figsize=(10, 13))
crop0 = lambda x: bounding_box_query(
    x,
    min_coordinate=[20000, 8000],
    max_coordinate=[20100, 8100],
    axes=("x", "y"),
    target_coordinate_system="global",
)
crop0(sdata).pl.render_labels("cell_labels").pl.show(
    ax=ax, title="Cell labels", coordinate_systems="global")

output:

CPU times: user 1h 21min 50s, sys: 45min 40s, total: 2h 7min 30s
Wall time: 1h 1min 27s

However, the run time of plotting not-cropped spatialdata seems acceptable:

%%time
sdata.pl.render_images("morphology_focus").pl.show(title="Morphology image")

output:

INFO     Rasterizing image for faster rendering.                                                                   
CPU times: user 2h 24min 28s, sys: 50min 15s, total: 3h 14min 43s
Wall time: 5min 20s

Is it because lacking of GPU?

Thanks for reaching out. Before answering, I ask you to verify two things:

  1. do you confirm that sdata is read from disk and not directly the output from xenium()? (i.e. you first run xenium(), then save the result, and then read again). This is crucial for fast performance.
  2. which version of spatialdata-plot are you using? I suggest using a recent one, i.e. at least 0.2.7 (the current version is 0.2.8 but it didn’t involve any performance related task, while 0.2.7 did).

Thank you.