spatialdata-plot
spatialdata-plot copied to clipboard
(Optional) fast extent computation for large vector data
As long as plotting is concerned, the extent of the data doesn't need to be super precise. The get_extent() function has a parameter exact=True, which could speed up the computation of extents for vector data when set to False.
Specifically, if exact=False, the extent is computed as the transformed extent of the raw data. This is guaranteed to contain all the data points, and usually is not too large of the real extent.
Therefore, for large collections of points (one can set a threshold empirically after some real tests), I would consider to consider setting exact=False to speed up things.
Note: maybe the speed up is negligible compared to the time require to render the data, so I would benchmark before making a decision.
Is this still relevant @LucaMarconato ?
yes
Yes; it would be fast to address this issue.
get_extent(..., exact=False) has an effect only for points and shapes that have a transformation.
- I would first check if setting it to
Falseleads to a performance improvement when plotting many points and when plotting many shapes. The points and shapes should have a transformation that does something, for instance a rotation by 45 degrees.
If there is no performance improvement (because for instance the rendering time is much larger), we can stop here. Otherwise I would switch to exact=False.
2. Note that the artifacts will have to be regenerated as when there is a rotation, exact=False will introduce some padding.