I am buffering around a road network with many small line segments and it takes a long time. When I tried using the profiler to see what was making it take so long most of the time is occupied by ".Call". So I am wondering what is happening in the .Call section and is there anything I could do to speed up this process?
Here is a reproducible example:
library(sf)
my_linestring_sfc <- st_sfc(
st_linestring(matrix(c(-10, -10, -1, -1, 0, 0), ncol = 2, byrow = TRUE)),
st_linestring(matrix(c(10, -10, 1, -1, 0, 0), ncol = 2, byrow = TRUE)),
st_linestring(matrix(c(0, 0, 0, 1, 0, 10), ncol = 2, byrow = TRUE))
)
line_lst <- map(1:10000 *5, ~my_linestring_sfc + .x)
lins <- do.call(c, line_lst)
profvis::profvis({st_buffer(lins, 100)})
