Skip to content

RPSS() performance

Hi @nmilders @jramon @vagudets

As you mentioned in the verification suite meeting that RPSS() takes a long time, I did some profiling for RPSS(). Unfortunately, the most time-consuming part is the easyVerification::convert2prob function, which is used in .GetProbs(). It uses a couple of apply() functions that are known to be heavy. I also improved RPS() and RPSS() to avoid using apply() if I can, but those parts are minor problems.

I provide two profiling files. (1) is a more realistic case (too big to be attached), and (2) is a lighter case.

library(profvis)

# (1)
set.seed(1)
exp1 <- array(rnorm(60), dim = c(member = 25, sdate = 10, lat = 180, lon = 360))
set.seed(2)
obs1 <- array(rnorm(20), dim = c(sdate = 10, lat = 180, lon = 360))

# (2)
set.seed(1)
exp1 <- array(rnorm(60), dim = c(member = 25, sdate = 1, lat = 18, lon = 36))
set.seed(2)
obs1 <- array(rnorm(20), dim = c(sdate = 1, lat = 18, lon = 36))

profvis({
  res <- RPSS(exp1, obs1)
})

(1) profiling file: /home/Earth/aho/tmp/RPSS_profvis.Rprofvis
(2) profiling file RPSS_small_profvis.Rprofvis

We can still merge the improvement !145 (merged) (better than nothing.) If you have any suggestion, please let me know, thanks!

Best,
An-Chi

Edited by aho