Skip to content

Benchmarks

aviezerl edited this page Dec 8, 2021 · 16 revisions

Logical tracks

Extract physical track

devtools::load_all()
options(emr_max.data.size = 1e9)
emr_db.connect("/net/mraid14/export/tgdata/db/tgdb/emr/mock/")
ptrack <- "WZMN.dx.1.250.11"
ltrack <- "ltrack"
ltrack_values <- "dx.250.1.star"

system.time(replicate(100, emr_extract(ptrack)))
  • vanilla: 1.059
  • dev: 1.096 (this is due to devtools::load_all() instead of library)
  • logical tracks: 0.928

Extract logical track (no values)

system.time(replicate(100, emr_extract(ltrack)))
  • logical tracks: 0.914

Extract logical track (with values)

system.time(replicate(10, emr_extract(ltrack_values)))
  • logical tracks: 3.916

Extract virtual track with values

emr_vtrack.create("vt", "diagnosis.250", params = c(11))
system.time(replicate(10, emr_extract("vt")))
  • vanilla: 13.729
  • dev: 15.897
  • logical tracks: 13.548

Extract tracks with explicit iterator

system.time(replicate(100, emr_extract(ptrack, iterator = ptrack)))
  • vanilla: 0.955
  • dev: 1.024
  • logical tracks: 0.857
system.time(replicate(100, emr_extract(ltrack, iterator = ltrack)))
  • logical tracks: 0.848

Value filters

devtools::load_all()
library(glue)
options(emr_max.data.size = 1e9)
emr_db.connect("/net/mraid14/export/tgdata/db/tgdb/emr/mock/", load_on_demand = FALSE)
dx_track <- "diagnosis.250"
lab_track <- "lab.103"
val <- 15 # around the 90th percentile

compare with screen and then extract

screen_and_extract <- function(){
    itr_df <- emr_screen(glue("{lab_track} >= {val}"), iterator = lab_track)
    emr_filter.create("f", itr_df, time.shift = c(-years(5), 0))
    emr_extract(dx_track, filter = "f")
}

value_filter <- function(){
    emr_filter.create("f", lab_track, val = val, operator = ">=", time.shift = c(-years(5), 0))
    emr_extract(dx_track, filter = "f")
}
system.time(replicate(10, screen_and_extract()))
  • screen and extract: 35.871
system.time(replicate(10, value_filter()))
  • value filter: 11.725
Clone this wiki locally