You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code using the binary arithmetic operators on sfc is slow when the number of geometries is large, which is bad news when there're hundreds of thousands of cells:
Try optimizing it by using st_coordinates() to get the coordinates, directly apply matrix multiplication for the linear transformation, and then use df2sf() (now using the really fast sfheaders package behind the scene) to turn it back to sf. Before going back to sf, I wonder if the sweep() step used to apply the translation is slow. I also wonder if this optimization issue should actually be opened in the sf repo instead of here.
The text was updated successfully, but these errors were encountered:
Right now the speedup would not work for GEOMETRY which has a mixture of different geometry types because st_coordinates would not work. I'm waiting for official performance improvements in sf itself as in r-spatial/sf#2376
The code using the binary arithmetic operators on
sfc
is slow when the number of geometries is large, which is bad news when there're hundreds of thousands of cells:SpatialFeatureExperiment/R/geometry_operation.R
Line 627 in efed2e7
From profiling, the slow part is the
mapply
called in thesf
package, which is essentially an R loop that is not parallelized:https://github.com/r-spatial/sf/blob/bd1940f68dd7607b7e9098ccc32c99e273c30a60/R/arith.R#L160
Try optimizing it by using
st_coordinates()
to get the coordinates, directly apply matrix multiplication for the linear transformation, and then usedf2sf()
(now using the really fastsfheaders
package behind the scene) to turn it back tosf
. Before going back tosf
, I wonder if thesweep()
step used to apply the translation is slow. I also wonder if this optimization issue should actually be opened in thesf
repo instead of here.The text was updated successfully, but these errors were encountered: