Description of feature
I have a SpatialData object with about 20 samples and in total ~10M cells, stored as shapes.
When calculating gr.spatial_neighbors_radius this takes about 5minutes (3min after #1198). Of these 5 minutes, 1:30min are spent in the _resolve_data function. This means (after the optimization in #1198) 50% of the time is spent on retrieving information from the spatialdata object. Specifically, it seems to be the compute_centroids() function that takes most of the time.
On the one hand, this can surely be optimized. On the other hand, I was wondering if caching would be an appropriate solution here. The centroids are required for all graph-based functions in squidpy and there's no point in recalculating them every time. Mabye they could be added as a points layer to spatialdata?
Description of feature
I have a SpatialData object with about 20 samples and in total ~10M cells, stored as shapes.
When calculating
gr.spatial_neighbors_radiusthis takes about 5minutes (3min after #1198). Of these 5 minutes, 1:30min are spent in the_resolve_datafunction. This means (after the optimization in #1198) 50% of the time is spent on retrieving information from the spatialdata object. Specifically, it seems to be thecompute_centroids()function that takes most of the time.On the one hand, this can surely be optimized. On the other hand, I was wondering if caching would be an appropriate solution here. The centroids are required for all graph-based functions in squidpy and there's no point in recalculating them every time. Mabye they could be added as a points layer to spatialdata?