Closed Robinlovelace closed 11 months ago
Code in most recent commit linked to above shows that it is ~2x quicker.
> fromPlace = sf::st_as_sf(lwgeom::st_startpoint(od))
> toPlace = sf::st_as_sf(lwgeom::st_endpoint(od))
> library(sf)
> bench::mark(check = FALSE, max_iterations = 1,
+ journey = (r1 <<- route(l = od, route_fun = journey, plan = "quietest")),
+ journey2 = (r2 <<- journey2(fromPlace, toPlace, id = od$route_id, plan = "quietest", segments = TRUE))
+ )
# A tibble: 2 × 13
expression min median `itr/sec` mem_alloc `gc/sec` n_itr n_gc total_time result memory time gc
<bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> <int> <dbl> <bch:tm> <list> <list> <list> <list>
1 journey 9.16s 9.16s 0.109 20.8MB 0.328 1 3 9.16s <NULL> <Rprofmem> <bench_tm> <tibble>
2 journey2 4.73s 4.73s 0.211 24.4MB 0.423 1 2 4.73s <NULL> <Rprofmem> <bench_tm> <tibble>
Warning message:
Some expressions had a GC in every iteration; so filtering is disabled.
Quick win to speed-up reading:
As raised by @mem48 here https://github.com/nptscot/cyclestreets-r/issues/1