Closed Nowosad closed 1 year ago
test if as.int() gives any speed improvements
The object is R matrix/array or SpatRaster? If SpatRaster, then the object is held in memory as float.
@kadyb yep -- we have a SpatRaster, but then we convert it into a matrix (as.matrix(x, wide = TRUE)
). The resulting matrix is either double (when as.int is not used previously) or integer (when as.int is applied beforehand).
I think once your merged the PR with the common calculates, we can also close this issue again?
Yep -- I plan to work on the remaining points during the next week and then I will undraft the PR.
@mhesselbarth My 2.1 changes are ready for your review and merge -- see https://github.com/r-spatialecology/landscapemetrics/pull/308
PR is merged to main and commoncalcs deleted. Will update the CRAN version soon.
Improvements (see https://github.com/Nowosad/lsm2023improvements):
calculate_lsm()
(and other related functions) to speed-up calculations of many metrics at the same time (see https://github.com/r-spatialecology/landscapemetrics/issues/154 and https://github.com/r-spatialecology/landscapemetrics/issues/199) [jn: added to the commoncalc branch]as.int()
gives any speed improvements [no visible improvements or deterioration in terms of speed; however the internal matrix object should be smaller, and thus I would suggest doing it]new_tibble(list(
approach [jn: the performance gain is ~20ms; rewritting is probably not worth it] [jn: later, we discovered that actually this was very important to improve window_lsm speed]rcpp_get_coocurrence_matrix_single
is used directly and indirectly by ~10 metrics -- there should be a way to improving this partBug fixes:
Questions to answer:
Misc: