Skip to contents

Since tidyhydro uses C++ under the hood, it performs slightly faster than similar R packages (like hydroGOF). The results are particularly noticeable in large datasets with \(N\) observations exceeding 1000.

Default dataset avacha

# NSE
bench::mark(
  tidyhydro = nse_vec(truth = avacha$obs, estimate = avacha$sim),
  hydroGOF = hydroGOF::NSE(sim = avacha$sim, obs = avacha$obs),
  relative = TRUE,
  check = TRUE,
  iterations = 25L,
  filter_gc = FALSE
)
#> # A tibble: 2 × 6
#>   expression   min median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <dbl>  <dbl>     <dbl>     <dbl>    <dbl>
#> 1 tidyhydro   1      1         2.63      40.9      NaN
#> 2 hydroGOF    3.53   3.42      1          1        NaN

# KGE
bench::mark(
  tidyhydro = kge_vec(truth = avacha$obs, estimate = avacha$sim),
  hydroGOF = hydroGOF::KGE(sim = avacha$sim, obs = avacha$obs, method = "2009"),
  relative = TRUE,
  check = TRUE,
  iterations = 25L,
  filter_gc = FALSE
)
#> # A tibble: 2 × 6
#>   expression   min median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <dbl>  <dbl>     <dbl>     <dbl>    <dbl>
#> 1 tidyhydro    1     1         9.85       1        NaN
#> 2 hydroGOF    10.0   9.94      1         29.9      NaN

# KGE'
bench::mark(
  tidyhydro = kge2012_vec(truth = avacha$obs, estimate = avacha$sim),
  hydroGOF = hydroGOF::KGE(sim = avacha$sim, obs = avacha$obs, method = "2012"),
  relative = TRUE,
  check = TRUE,
  iterations = 25L,
  filter_gc = FALSE
)
#> # A tibble: 2 × 6
#>   expression   min median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <dbl>  <dbl>     <dbl>     <dbl>    <dbl>
#> 1 tidyhydro   1      1         17.7      1         NaN
#> 2 hydroGOF    8.25   8.31       1        8.90      Inf

# pBIAS
bench::mark(
  tidyhydro = pbias_vec(truth = avacha$obs, estimate = avacha$sim),
  hydroGOF = hydroGOF::pbias(sim = avacha$sim, obs = avacha$obs, dec = 9),
  relative = TRUE,
  check = TRUE,
  iterations = 25L,
  filter_gc = FALSE
)
#> # A tibble: 2 × 6
#>   expression   min median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <dbl>  <dbl>     <dbl>     <dbl>    <dbl>
#> 1 tidyhydro   1      1         2.45      1         NaN
#> 2 hydroGOF    2.68   2.57      1         5.23      NaN

# MSE
bench::mark(
  tidyhydro = mse_vec(truth = avacha$obs, estimate = avacha$sim),
  hydroGOF = hydroGOF::mse(sim = avacha$sim, obs = avacha$obs),
  relative = TRUE,
  check = TRUE,
  iterations = 25L,
  filter_gc = FALSE
)
#> # A tibble: 2 × 6
#>   expression   min median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <dbl>  <dbl>     <dbl>     <dbl>    <dbl>
#> 1 tidyhydro   1      1         3.42      1         NaN
#> 2 hydroGOF    3.25   3.20      1         6.35      NaN