Closed josie-hughes closed 3 years ago
Finished. benchmark from test - updateDisturbance for speed comparison
# bm3 <- bench::mark(
# distMet = dm2 <- disturbanceMetrics(
# landCover = plcD,
# natDist = natDistD,
# anthroDist = anthroDistD,
# linFeat = linFeatDras,
# projectPoly = projectPolyD,
# padFocal = FALSE, # assume data outside area is 0 for all variables
# bufferWidth = 500
# ),
# updateAnthro = updateDisturbance(dm2, newData = list(anthroDist = anthroDistD)),
# updateLF = updateDisturbance(dm2, newData = list(linFeat = linFeatDras)),
# updateNat = updateDisturbance(dm2, newData = list(natDist = natDistD)),
# updateAll = updateDisturbance(dm2, newData = list(linFeat = linFeatDras,
# anthroDist = anthroDistD,
# natDist = natDistD)),
# min_iterations = 5,
# check = FALSE
# )
# bm3
# # A tibble: 5 x 13
# expression min median `itr/sec` mem_alloc `gc/sec` n_itr n_gc total_time
# <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl> <int> <dbl> <bch:tm>
# 1 distMet 2.12s 2.16s 0.463 69.8MB 0 5 0 10.81s
# 2 updateAnthro 773.72ms 799.51ms 1.23 59.3MB 0 5 0 4.05s
# 3 updateLF 774.43ms 780.72ms 1.28 59.2MB 0 5 0 3.91s
# 4 updateNat 704.12ms 709.01ms 1.41 51.9MB 0 5 0 3.55s
# 5 updateAll 1.71s 1.73s 0.573 66.3MB 0 5 0 8.73s
analogous to update method for caribouHabitat, to avoid redundant geospatial data processing when projecting landscape change over time or multiple iterations.