Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

speed #7

Open
SymbolixAU opened this issue Jun 3, 2018 · 0 comments
Open

speed #7

SymbolixAU opened this issue Jun 3, 2018 · 0 comments

Comments

@SymbolixAU
Copy link
Collaborator

SymbolixAU commented Jun 3, 2018

Some benchmarks are slow

library(microbenchmark)
library(sf)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
wkt <- sf::st_as_text(nc$geometry)

microbenchmark(
  bg = {
    d <- bg_distance(wkt, strategy = "geographic")
  },
  sf = {
    d <- sf::st_distance(nc)
  },
  times = 3
)
# Unit: seconds
# expr      min       lq      mean    median        uq       max neval
#   bg 13.99757 14.15848 14.319665 14.319391 14.480715 14.642039     3
#   sf  8.04796  8.16323  8.254405  8.278499  8.357628  8.436756     3

and some are quicker

microbenchmark(
  sf = {
    sf::st_area(nc$geometry)
  },
  bg = {
    bg_area(wkt)
  }
)
# Unit: milliseconds
# expr       min        lq      mean    median        uq       max neval
# sf   12.335568 15.184881 18.774818 17.142446 19.742249 103.63335   100
# bg    5.307456  5.821789  7.391984  6.822984  8.333742  13.99982   100

pourquoi?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants