Perfom benchmarkinng tests on sprawl::extract_rast

  library(ggplot2)
  library(sprawl)
  library(compiler)
  fc = cmpfun(extract_rast)
  # in_rastfile <- "/Documents/Source/git/sprawl/inst/extdata/tif_world.tif"
  in_rast  <- build_testraster(200,200,1)
  in_shape <- readshape("/Documents/Source/git/sprawl/inst/extdata/grid_world.shp")
  npolys   <- 50
  in_polys <- in_shape[sample(1:5151, npolys),]

  mb <- microbenchmark::microbenchmark(
    out_std = extract_rast(in_rast, in_polys, verbose = F),
    out_comp = fc(in_rast, in_polys, verbose = F), 
    times = 50
  )
  boxplot(mb) + theme_bw()


IREA-CNR-MI/sprawl documentation built on May 27, 2019, 1:12 p.m.