Skip to content

Instantly share code, notes, and snippets.

@dbaston
dbaston / bench.sh
Created July 30, 2020 00:28
crude exactextractr benchmark
time ./exactextract -r "pop:/home/dan/data/gpw_v4_population_count_rev11_2020_30_sec.tif" -p /home/dan/data/gadm36_level_0.gpkg -f GID_0 --stat "sum(pop)" -o /tmp/country_pop.csv
# 37.42s user 5.62s system 98% cpu 43.520 total
time R -q -e 'r <- raster::raster("/home/dan/data/gpw_v4_population_count_rev11_2020_30_sec.tif"); p <- sf::st_read("/home/dan/data/gadm36_level_0.gpkg"); country_pop <- cbind(p$GID_0, exactextractr::exact_extract(r, p, "sum")); write.csv(country_pop, "/tmp/country_pop_r.csv", row.names=FALSE, quote=FALSE)'
# 69.44s user 10.54s system 99% cpu 1:20.01 total