Skip to content

A place to put data (in the releases) and code (in any language) to test performance

License

Notifications You must be signed in to change notification settings

ATFutures/geobench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geobench is a place to put data (in the releases) and code (in any language) to test performance.

It relies on the bench package for testing and datasets uploaded into the releases.

Pre-requisites

This section lists the software that needs to be installed to run these benchmarks. It will likely evolve over time.

R packages

  • bench
  • sf
  • sp
  • spData

Set-up

The code in this section only needs to run once, or at least each time a new dataset is added to the benchmarks.

Python was set-up to run python3. This can be done at the system level or, if you’re running these benchmarks from RStudio by adding the following line to .Renviron (which can be edited with usethis::edit_r_environ()):

RETICULATE_PYTHON=/usr/bin/python3

Large point dataset covering UK

ac = stats19::get_stats19(year = 2022, output_format = "sf")
sf::write_sf(ac, "ac.geojson", delete_dsn = TRUE)
fs::file_size("ac.geojson")
# 147 MB .geojson file
sf::write_sf(ac[1:1e6, ], "ac-M.geojson", delete_dsn = TRUE)  
sf::write_sf(ac[1:1e5, ], "ac-100K.geojson", delete_dsn = TRUE)
sf::write_sf(ac[1:1e4, ], "ac-10K.geojson", delete_dsn = TRUE)
sf::write_sf(ac[1:1e3, ], "ac-1K.geojson", delete_dsn = TRUE)
zip("ac.geojson.zip", "ac.geojson") # 14 MB
piggyback::pb_upload(file = "ac.geojson.zip")
piggyback::pb_upload(file = "ac-100K.geojson")
piggyback::pb_upload(file = "ac-10K.geojson")
reticulate::py_install("pytictoc")

Download data

if(!file.exists("ac.geojson")) {
  download.file("https://github.com/ATFutures/geobench/releases/download/0.0.1/ac.geojson.zip", "ac.geojson.zip")
  unzip("ac.geojson.zip")
  download.file("https://github.com/ATFutures/geobench/releases/download/0.0.1/ac-100k.geojson", "ac-100k.geojson")
  download.file("https://github.com/ATFutures/geobench/releases/download/0.0.1/ac-10k.geojson", "ac-10k.geojson")
}

Benchmark 1: reading data

Full dataset

Took too long to run and consumed too much memory to evaluate each time. Results from first run pasted below:

bench::mark(iterations = 1, check = FALSE,
            {ac_sf = sf::read_sf("ac.geojson")},
            {ac_sp = rgdal::readOGR("ac.geojson")}
)
#> expression     min    mean   median     max `itr/sec` mem_alloc  
#>   <chr>      <bch:t> <bch:t> <bch:tm> <bch:t>     <dbl> <bch:byt>       
#> 1 {...         36.7s   36.7s    36.7s   36.7s   0.0272    655.6MB 
#> 2 {...            2m      2m       2m      2m   0.00835     1.2GB 

100K sample

This runs happily and quickly so the results are run each time:

bench::mark(iterations = 1, check = FALSE,
            geosf = {ac_gsf = geojsonsf::geojson_sf("ac-100K.geojson")},
            sf = {ac_sf10k = sf::read_sf("ac-100K.geojson")},
            sp = {ac_sp10k = rgdal::readOGR("ac-100K.geojson", verbose = F)}
)
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: OGR support is provided by the sf and terra packages among others
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
#> # A tibble: 3 Ă— 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 geosf         4.89s    4.89s    0.204     36.3MB   1.02  
#> 2 sf             6.8s     6.8s    0.147     70.2MB   1.77  
#> 3 sp            1.63m    1.63m    0.0102     112MB   0.0102
pip3 install geopandas
pip3 install pytictoc
pip3 install rasterio
import sys
print(sys.version)
#> 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
import geopandas as gpd
from pytictoc import TicToc
t = TicToc()
t.tic()
s = gpd.read_file("ac-100K.geojson")
t.toc()
#> Elapsed time is 43.601560 seconds.

Benchmark 2: spatial subsetting

Work in progress…

System info

system("lscpu", intern = TRUE)
#>  [1] "Architecture:                       x86_64"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
#>  [2] "CPU op-mode(s):                     32-bit, 64-bit"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
#>  [3] "Address sizes:                      39 bits physical, 48 bits virtual"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#>  [4] "Byte Order:                         Little Endian"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
#>  [5] "CPU(s):                             16"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
#>  [6] "On-line CPU(s) list:                0-15"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
#>  [7] "Vendor ID:                          GenuineIntel"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#>  [8] "Model name:                         12th Gen Intel(R) Core(TM) i5-1240P"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#>  [9] "CPU family:                         6"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#> [10] "Model:                              154"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> [11] "Thread(s) per core:                 2"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#> [12] "Core(s) per socket:                 12"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
#> [13] "Socket(s):                          1"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#> [14] "Stepping:                           3"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#> [15] "CPU max MHz:                        4400.0000"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
#> [16] "CPU min MHz:                        400.0000"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
#> [17] "BogoMIPS:                           4224.00"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
#> [18] "Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities"
#> [19] "Virtualisation:                     VT-x"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
#> [20] "L1d cache:                          448 KiB (12 instances)"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
#> [21] "L1i cache:                          640 KiB (12 instances)"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
#> [22] "L2 cache:                           9 MiB (6 instances)"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> [23] "L3 cache:                           12 MiB (1 instance)"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
#> [24] "NUMA node(s):                       1"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#> [25] "NUMA node0 CPU(s):                  0-15"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
#> [26] "Vulnerability Gather data sampling: Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [27] "Vulnerability Itlb multihit:        Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [28] "Vulnerability L1tf:                 Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [29] "Vulnerability Mds:                  Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [30] "Vulnerability Meltdown:             Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [31] "Vulnerability Mmio stale data:      Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [32] "Vulnerability Retbleed:             Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [33] "Vulnerability Spec rstack overflow: Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [34] "Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
#> [35] "Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
#> [36] "Vulnerability Spectre v2:           Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#> [37] "Vulnerability Srbds:                Not affected"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
#> [38] "Vulnerability Tsx async abort:      Not affected"

About

A place to put data (in the releases) and code (in any language) to test performance

Resources

License

Stars

Watchers

Forks

Packages

No packages published