Benchmarking
benchmarking.Rmd
Timings hydrorecipes vs recipes
Timings for the hydrorecipes package are prefaced with an “h”. The first few comparisons include the R6 interface in hydrorecipes to check if there is a loss of speed compared to the standard API. Most users are likely to use the standard API so the remaining benchmarks only present that. Typical speed improvements are between 2-10x and memory consumption is typically half of the recipes package.
creating a recipe
relative <- TRUE
n <- c(1e2, 1e4, 5e6)
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows)
bench::mark(
hrec1 = hydrorecipes:::Recipe$new(formula = formula, data = dat),
hrec2 = recipe(formula = formula, data = dat),
rec = recipes::recipe(formula = formula, data = dat),
check = FALSE,
relative = relative
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 9 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec1 100 1 1 5.88 539. 1.00
#> 2 hrec2 100 1.00 1.00 5.87 1 1
#> 3 rec 100 6.02 5.91 1 4648. 1.00
#> 4 hrec1 10000 1 1 5.80 1 1
#> 5 hrec2 10000 1.00 1.00 5.87 1 1.00
#> 6 rec 10000 6.00 5.85 1 5.07 1.01
#> 7 hrec1 5000000 1.00 1.01 5.86 1 2.02
#> 8 hrec2 5000000 1 1 5.92 1 2.02
#> 9 rec 5000000 6.01 5.88 1 5.07 1
add a step
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows)
bench::mark(
hrec1 = hydrorecipes:::Recipe$new(formula = formula, data = dat)$
add_step(hydrorecipes:::StepCenter$new(x)),
hrec2 = recipe(formula = formula, data = dat) |>
step_center(x),
rec = {recipes::recipe(formula = formula, data = dat) |>
recipes::step_center(x)},
check = FALSE,
relative = relative
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 9 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec1 100 1 1 3.94 55.9 2.02
#> 2 hrec2 100 1.03 1.03 3.82 1 2.02
#> 3 rec 100 4.05 3.94 1 16.4 1
#> 4 hrec1 10000 1 1 3.97 1 1
#> 5 hrec2 10000 1.04 1.04 3.77 1 1.00
#> 6 rec 10000 4.08 3.95 1 1.51 1.01
#> 7 hrec1 5000000 1 1 3.93 1 2.03
#> 8 hrec2 5000000 1.04 1.03 3.84 1 2.03
#> 9 rec 5000000 4.05 3.94 1 1.51 1
step_center prep
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows)
hrec1 = hydrorecipes:::Recipe$new(formula = formula, data = dat)$
add_step(hydrorecipes:::StepCenter$new(x))
hrec2 = recipe(formula = formula, data = dat) |>
step_center(x)
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_center(x)
bench::mark(
hrec1$prep(),
hrec2 |> prep(),
rec |> recipes::prep(),
check = FALSE,
min_iterations = 1L,
relative = relative
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 9 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec1$prep() 100 1.02 1.02 77.7 53.8 2.01
#> 2 prep(hrec2) 100 1 1 80.3 1 3.21
#> 3 recipes::prep(rec) 100 84.7 81.3 1 1523. 1
#> 4 hrec1$prep() 10000 1 1 78.9 NaN 2.00
#> 5 prep(hrec2) 10000 1.00 1.01 78.3 NaN 3.01
#> 6 recipes::prep(rec) 10000 81.8 80.0 1 Inf 1
#> 7 hrec1$prep() 5000000 1.00 1 67.3 NaN NaN
#> 8 prep(hrec2) 5000000 1 1.01 66.9 NaN NaN
#> 9 recipes::prep(rec) 5000000 27.7 68.1 1 Inf Inf
step_center prep and bake
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows)
hrec1 = hydrorecipes:::Recipe$new(formula = formula, data = dat)$
add_step(hydrorecipes:::StepCenter$new(x))
hrec2 = recipe(formula = formula, data = dat) |>
step_center(x)
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_center(x)
bench::mark(
hrec1$prep()$bake(),
hrec2 |> prep() |> bake(),
rec |> recipes::prep() |> recipes::bake(new_data = NULL),
check = FALSE,
min_iterations = 1L,
relative = relative
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 9 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec1$prep()$bake() 1e2 1 1.01 70.5 47.6 1.00
#> 2 bake(prep(hrec2)) 1e2 1.01 1 73.0 1 1
#> 3 recipes::bake(recipes::prep(r… 1e2 76.0 73.6 1 46.4 1.06
#> 4 hrec1$prep()$bake() 1e4 1 1 71.9 1 1.00
#> 5 bake(prep(hrec2)) 1e4 1.00 1.01 71.6 1 1
#> 6 recipes::bake(recipes::prep(r… 1e4 74.5 72.9 1 2.94 1.06
#> 7 hrec1$prep()$bake() 5e6 1 1.01 23.2 1 NaN
#> 8 bake(prep(hrec2)) 5e6 1.01 1 23.3 1 NaN
#> 9 recipes::bake(recipes::prep(r… 5e6 24.4 23.5 1 2.50 Inf
step_center
formula <- as.formula(y~x+z)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows,
z = rnorm(rows))
bench::mark(
hrec = (recipe(formula = formula, data = dat) |>
step_center(x) |>
plate())[["x"]],
rec = (recipes::recipe(formula = formula, data = dat) |>
recipes::step_center(x) |>
recipes::prep() |>
recipes::bake(new_data = NULL))[["x"]],
check = TRUE,
min_iterations = 1L,
relative = relative
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 14.3 5.17 1
#> 2 rec 100 14.5 14.2 1 1 1.06
#> 3 hrec 10000 1 1 14.4 1 1
#> 4 rec 10000 14.4 14.2 1 2.82 1.05
#> 5 hrec 5000000 1 1 6.60 1 1
#> 6 rec 5000000 10.6 6.38 1 2.50 1.38
step_scale
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows,
z = rnorm(rows))
bench::mark(
hrec = (recipe(formula = formula, data = dat) |>
step_scale(x, fun = fsd, n_sd = 2L) |>
plate())[["x"]],
rec = (recipes::recipe(formula = formula, data = dat) |>
recipes::step_scale(x, factor = 2L) |>
recipes::prep() |>
recipes::bake(new_data = NULL))[["x"]],
check = TRUE,
relative = relative,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 14.0 2.30 2.01
#> 2 rec 100 14.2 13.9 1 1 1
#> 3 hrec 10000 1 1 13.5 1 1
#> 4 rec 10000 13.6 13.4 1 2.35 1.05
#> 5 hrec 5000000 1 1 1.90 1 1
#> 6 rec 5000000 1.98 1.88 1 2.00 2.64
step_intercept
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = rnorm(rows))
bench::mark(
hrec = (recipe(formula = formula, data = dat) |>
step_intercept() |>
plate("tbl"))[["intercept"]],
rec = (recipes::recipe(formula = formula, data = dat) |>
recipes::step_intercept() |>
recipes::prep() |>
recipes::bake(new_data = NULL))[["intercept"]],
check = TRUE,
relative = relative,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 14.1 5.75 1
#> 2 rec 100 14.4 13.9 1 1 1.33
#> 3 hrec 10000 1 1 14.1 1 1.97
#> 4 rec 10000 14.2 14.1 1 1.41 1
#> 5 hrec 5000000 1 1 4.20 1 4.33
#> 6 rec 5000000 4.21 4.27 1 1.00 1
step_normalize
formula <- as.formula(y~x+z)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = rnorm(rows),
z = rnorm(rows))
bench::mark(
hrec1 = (recipe(formula = formula, data = dat) |>
step_normalize(c(x, z, y)) |>
plate("tbl"))[, c("x", "z", "y")],
hrec2 = (recipe(formula = formula, data = dat) |>
step_center(c(x, z, y)) |>
step_scale(c(x, z, y)) |>
plate("tbl"))[, c("x", "z", "y")],
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_normalize(x, y, z) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
relative = relative,
min_iterations = 1L,
check = TRUE
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 9 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec1 100 1 1 14.1 53.8 1.96
#> 2 hrec2 100 1.36 1.36 10.4 1 1.96
#> 3 rec 100 14.1 13.9 1 8.72 1
#> 4 hrec1 10000 1 1 11.2 1 2.02
#> 5 hrec2 10000 1.31 1.18 9.16 1.00 1
#> 6 rec 10000 12.1 10.8 1 1.41 2.14
#> 7 hrec1 5000000 1 1 1.19 1 1.25
#> 8 hrec2 5000000 1.02 1.00 1.27 1.00 1
#> 9 rec 5000000 1.67 1.63 1 1.33 1.05
step_drop_columns
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = rnorm(rows),
z = rnorm(rows))
bench::mark(
hrec = recipe(formula = formula, data = dat) |>
step_drop_columns(z) |>
plate("tbl"),
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_rm(z) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
check = TRUE,
relative = relative
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 14.5 7.59 2.01
#> 2 rec 100 14.8 14.4 1 1 1
#> 3 hrec 10000 1 1 14.5 1 1
#> 4 rec 10000 14.8 14.6 1 57.6 2.17
#> 5 hrec 5000000 1 1 26.1 1 1
#> 6 rec 5000000 24.7 26.7 1 14563. 1.04
step_subset_na_omit
formula <- as.formula(y~x+z)
results <- bench::press(
rows = c(1e6, 1e7),
{
dat <- tibble(x = rnorm(rows),
z = rnorm(rows),
y = rnorm(rows))
dat[1:5, "x"] <- NA_real_
dat[100:150, "z"] <- NA_real_
dat[10000:15000, "y"] <- NA_real_
bench::mark(
hrec1 = (recipe(formula = formula, data = dat) |>
step_subset_na_omit(terms = x) |>
prep() |>
bake())$get_result("tbl"),
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_naomit(x) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
relative = FALSE,
min_iterations = 1L,
check = TRUE
)
}
)
#> Running with:
#> rows
#> 1 1000000
#> 2 10000000
results
#> # A tibble: 4 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 1000000 5.98ms 6.19ms 147. 34.9MB 13.8
#> 2 rec 1000000 26.01ms 26.28ms 37.9 34.5MB 4.45
#> 3 hrec1 10000000 70.13ms 70.59ms 14.2 343.3MB 28.3
#> 4 rec 10000000 118.51ms 118.51ms 8.44 343.4MB 25.3
step_subset_rows
formula <- as.formula(y~x+z)
results <- bench::press(
rows = c(1e6, 1e7),
{
dat <- tibble(x = rnorm(rows),
z = rnorm(rows),
y = rnorm(rows))
sub <- sample(1:rows, size = 5e5)
bench::mark(
hrec1 = (recipe(formula = formula, data = dat) |>
step_subset_rows(row_numbers = sub) |>
prep() |>
bake())$get_result("tbl"),
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_slice(sub) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
base = dat[sub, ],
relative = FALSE,
min_iterations = 1L,
check = TRUE
)
}
)
#> Running with:
#> rows
#> 1 1000000
#> 2 10000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 1000000 4.63ms 8.28ms 139. 12MB 4.27
#> 2 rec 1000000 31.95ms 32.55ms 30.1 30.7MB 2.15
#> 3 base 1000000 8.58ms 8.92ms 112. 19.1MB 8.76
#> 4 hrec1 10000000 8.16ms 8.54ms 106. 11.4MB 3.22
#> 5 rec 10000000 56.83ms 67.65ms 15.4 64.9MB 2.20
#> 6 base 10000000 11.07ms 16.33ms 65.8 19.1MB 2.06
step_subset_sample
formula <- as.formula(y~x+z)
results <- bench::press(
rows = c(1e6, 1e7),
{
dat <- data.frame(x = rnorm(rows),
z = rnorm(rows),
y = rnorm(rows))
bench::mark(
h <- {hrec1 = recipe(formula = formula, data = dat) |>
step_subset_sample(size = 10000L) |>
prep() |>
bake()
h = nrow(hrec1$get_result("tbl"))},
rec = nrow(recipes::recipe(formula = formula, data = dat) |>
recipes::step_sample(size = 10000 / rows) |>
recipes::prep() |>
recipes::bake(new_data = NULL)),
relative = FALSE,
min_iterations = 1L,
check = TRUE
)
}
)
#> Running with:
#> rows
#> 1 1000000
#> 2 10000000
results
#> # A tibble: 4 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:t> <bch:t> <dbl> <bch:byt> <dbl>
#> 1 h <- { hrec1 = bake(prep(s… 1e6 1.65ms 1.71ms 583. 860.8KB 2.02
#> 2 rec 1e6 21.33ms 21.59ms 46.2 8.44MB 4.40
#> 3 h <- { hrec1 = bake(prep(s… 1e7 2.01ms 2.04ms 485. 315.12KB 2.02
#> 4 rec 1e7 48.14ms 51.62ms 19.3 76.9MB 2.14
step_cross_correlation
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = rnorm(rows))
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_cross_correlation(c(x, z, y), lag_max = 1000) |>
plate("tbl"),
min_iterations = 1L,
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 3 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100 1.29ms 1.33ms 748. 559.2KB 4.10
#> 2 hrec1 10000 1.98ms 2.01ms 496. 18.1KB 2.02
#> 3 hrec1 5000000 523.98ms 523.98ms 1.91 18.1KB 0
x <- rnorm(5e5)
y <- rnorm(5e5)
lag_max <- 1000
results <- bench::mark(fft_ccf <- hydrorecipes:::convolve_correlation(x, y, lag_max),
ccf_base <- as.numeric(ccf(x, y, lag.max = lag_max, plot = FALSE)$acf),
min_iterations = 1L,
check = TRUE
)
results
#> # A tibble: 2 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:t> <bch:> <dbl> <bch:byt> <dbl>
#> 1 fft_ccf <- hydrorecipes:::convolv… 39.65ms 39.9ms 25.0 15.7KB 0
#> 2 ccf_base <- as.numeric(ccf(x, y, … 1.96s 1.96s 0.511 143.7MB 0
step_lag
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = as.numeric(1:rows),
z = rnorm(rows))
bench::mark(
hrec1 = unname(recipe(formula = formula, data = dat) |>
step_lead_lag(x, lag = 1:30) |>
plate("tbl")),
rec = unname(recipes::recipe(formula = formula, data = dat) |>
recipes::step_lag(x, lag = 1:30) |>
recipes::prep() |>
recipes::bake(new_data = NULL)),
check = TRUE,
relative = relative,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec1 100 1 1 8.37 2.31 1
#> 2 rec 100 8.39 8.37 1 1 2.21
#> 3 hrec1 10000 1 1 6.93 1 1
#> 4 rec 10000 7.36 7.35 1 2.55 1.09
#> 5 hrec1 5000000 1 1 1.68 1 1.12
#> 6 rec 5000000 1.75 1.68 1 2.52 1
step_distributed_lag
formula <- as.formula(y~x)
results <- bench::press(
rows = c(5e5, 5e6, 1e7),
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows,
z = rnorm(rows))
bench::mark(
hrec = recipe(formula = formula, data = dat) |>
step_distributed_lag(x, knots = log_lags(5, 86401)) |>
prep() |> bake(),
check = FALSE,
relative = FALSE,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 500000
#> 2 5000000
#> 3 10000000
results
#> # A tibble: 3 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec 500000 69.2ms 71.1ms 14.1 19.1MB 0
#> 2 hrec 5000000 470.2ms 472.8ms 2.12 155.9MB 0
#> 3 hrec 10000000 938.7ms 938.7ms 1.07 308.5MB 0
step_harmonic
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows,
z = rnorm(rows))
bench::mark(
hrec = recipe(formula = formula, data = dat) |>
step_harmonic(x,
frequency = c(1.0, 2.0, 3.0),
cycle_size = 0.1,
starting_value = 0.0) |>
plate("tbl"),
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_harmonic(x,
frequency = c(1.0, 2.0, 3.0),
cycle_size = 0.1,
starting_val = 0.0,
keep_original_cols = TRUE) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
# sin and cos terms order is different
check = FALSE,
relative = relative,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 13.8 3.30 1
#> 2 rec 100 14.2 13.9 1 1 1.03
#> 3 hrec 10000 1 1 7.39 1 1
#> 4 rec 10000 7.40 7.38 1 3.48 2.18
#> 5 hrec 5000000 1 1 1.16 1 NaN
#> 6 rec 5000000 1.16 1.16 1 3.43 Inf
# rows <- 1e6
# dat <- data.frame(x = rnorm(rows),
# y = 1:rows,
# z = rnorm(rows))
# bench::mark(
#
# {hrec = recipe(formula = formula, data = dat) |>
# step_harmonic(x,
# frequency = c(1.0, 2.0, 3.0),
# cycle_size = 0.1,
# starting_value = 0.0,
# varying = "cycle_size") |>
# step_harmonic(x,
# frequency = c(1.0, 2.0, 3.0),
# cycle_size = 0.1,
# starting_value = 0.0) |>
# step_intercept() |>
# step_center(x) |>
# prep() |>
# bake()},
#
# {hrec$steps[[2]]$update_step("cycle_size", 0.2)
# hrec$bake()
# },
# check = FALSE
# )
step_pca
set.seed(1)
formula <- as.formula(x~a + b + c + d + e + f + g + h + i + j + k + l)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
a = rnorm(rows),
b = rnorm(rows),
c = rnorm(rows),
d = rnorm(rows),
e = rnorm(rows),
f = rnorm(rows),
g = rnorm(rows),
h = rnorm(rows),
i = rnorm(rows),
j = rnorm(rows),
k = rnorm(rows),
l = rnorm(rows)
)
bench::mark(
hrec1 = recipe(formula = formula, data = dat)|>
step_pca(c(a,b,c,d,e,f,g,h,i,j,k,l), n_comp = 10L) |>
plate(),
hrec2 = recipe(formula = formula, data = dat)|>
step_pca(c(a,b,c,d,e,f,g,h,i,j,k,l), n_comp = 5L) |>
plate(),
hrec3 = recipe(formula = formula, data = dat)|>
step_pca(c(a,b,c,d,e,f,g,h,i,j,k,l),
n_comp = 10L,
center = FALSE,
scale = FALSE) |>
plate(),
hrec4 = recipe(formula = formula, data = dat)|>
step_pca(c(a,b,c,d,e,f,g,h,i,j,k,l),
n_comp = 5L,
center = FALSE,
scale = FALSE) |>
plate(),
rec1 = recipes::recipe(formula = formula, data = dat) |>
recipes::step_pca(recipes::all_predictors(),
num_comp = 10L,
options = list(center = TRUE, scale. = TRUE))|>
recipes::prep() |>
recipes::bake(new_data = NULL),
rec2 = recipes::recipe(formula = formula, data = dat) |>
recipes::step_pca(recipes::all_predictors(),
num_comp = 5L,
options = list(center = TRUE, scale. = TRUE)) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
rec3 = recipes::recipe(formula = formula, data = dat) |>
recipes::step_pca(recipes::all_predictors(),
num_comp = 10L) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
rec4 = recipes::recipe(formula = formula, data = dat) |>
recipes::step_pca(recipes::all_predictors(),
num_comp = 5L) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
check = FALSE,
relative = relative,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
print(results, n = 100)
#> # A tibble: 24 × 14
#> expression rows min median `itr/sec` mem_alloc `gc/sec` n_itr n_gc
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl>
#> 1 hrec1 100 1.03 1.02 14.4 15.5 2.00 321 2
#> 2 hrec2 100 1.02 1.02 14.5 1 1.99 324 2
#> 3 hrec3 100 1.00 1.00 14.7 1.20 2.00 329 2
#> 4 hrec4 100 1 1 14.8 1 2.00 331 2
#> 5 rec1 100 14.9 14.7 1 13.6 2.13 21 2
#> 6 rec2 100 14.7 14.5 1.02 6.04 2.28 20 2
#> 7 rec3 100 14.6 14.3 1.03 3.35 1 23 1
#> 8 rec4 100 14.2 14.0 1.06 3.00 2.15 22 2
#> 9 hrec1 10000 1.61 1.63 8.18 1.22 Inf 99 1
#> 10 hrec2 10000 1.59 1.58 8.28 1 NaN 102 0
#> 11 hrec3 10000 1.02 1.02 12.4 1.22 Inf 149 1
#> 12 hrec4 10000 1 1 12.3 1 Inf 147 1
#> 13 rec1 10000 13.3 13.2 1 6.02 Inf 12 1
#> 14 rec2 10000 13.0 12.9 1.02 5.69 Inf 12 1
#> 15 rec3 10000 11.2 11.1 1.20 2.24 Inf 14 1
#> 16 rec4 10000 10.9 10.9 1.23 1.92 Inf 14 1
#> 17 hrec1 5000000 2.21 2.21 3.83 1.22 1.38 1 3
#> 18 hrec2 5000000 1.80 1.80 4.70 1 1.13 1 2
#> 19 hrec3 5000000 1.41 1.41 6.02 1.22 1.44 1 2
#> 20 hrec4 5000000 1 1 8.46 1 1.01 1 1
#> 21 rec1 5000000 8.46 8.46 1 6.01 1.56 1 13
#> 22 rec2 5000000 7.93 7.93 1.07 5.68 1.02 1 8
#> 23 rec3 5000000 3.04 3.04 2.78 2.23 1 1 3
#> 24 rec4 5000000 3.14 3.14 2.70 1.90 1.61 1 5
#> # ℹ 5 more variables: total_time <bch:tm>, result <list>, memory <list>,
#> # time <list>, gc <list>
step_dummy
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = qF(sample(1:10, rows, replace = TRUE)),
z = rnorm(rows))
bench::mark(
hrec = unname(recipe(formula = formula, data = dat) |>
step_dummy(y) |>
plate("tbl"))[,3:11],
rec = unname(recipes::recipe(formula = formula, data = dat) |>
recipes::step_dummy(y, keep_original_cols = TRUE) |>
recipes::prep() |>
recipes::bake(new_data = NULL))[,3:11],
check = TRUE,
relative = relative,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 7.63 1 1
#> 2 rec 100 7.74 7.65 1 1.33 1.05
#> 3 hrec 10000 1 1 11.3 1 1.91
#> 4 rec 10000 11.4 11.4 1 17.7 1
#> 5 hrec 5000000 1 1 74.6 1 7.46
#> 6 rec 5000000 158. 157. 1 13.0 1
step_find_interval
- no direct comparison so compare to step_cut
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows,
z = rnorm(rows))
bench::mark(
hrec = recipe(formula = formula, data = dat) |>
step_find_interval(x, vec = c(-0.1, 0, 0.1)) |>
plate("tbl"),
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_cut(x, breaks = c(-0.1, 0, 0.1)) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
check = FALSE,
relative = relative,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 14.2 3.14 1.78
#> 2 rec 100 14.4 14.2 1 1 1
#> 3 hrec 10000 1 1 13.0 1 1
#> 4 rec 10000 13.2 13.1 1 3.44 1.01
#> 5 hrec 5000000 1 1 3.99 1 NaN
#> 6 rec 5000000 3.98 3.98 1 3.25 NaN
step_varying
formula <- as.formula(y~x+z)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rep(1, rows),
y = 1:rows,
z = rnorm(rows))
bench::mark(
hrec = recipe(formula = formula, data = dat) |>
step_varying(c(x, y, z)) |>
plate("tbl"),
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_zv(x, y, z) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
check = TRUE,
relative = relative,
min_iterations = 1L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 15.0 6.03 1
#> 2 rec 100 15.0 14.9 1 1 1.01
#> 3 hrec 10000 1 1 15.2 1 1
#> 4 rec 10000 15.4 15.3 1 32.9 1.03
#> 5 hrec 5000000 1 1 73.2 1 Inf
#> 6 rec 5000000 74.1 73.4 1 34.1 NaN
step_kernel_filter
step_kernel_filter uses an Fast Fourier Transform (FFT) based convolution instead of an explicit sliding window. This should be much faster for large datasets and particularly when the kernel size is also large.
formula <- as.formula(y~x+z)
results <- bench::press(
rows = c(2e4, 2e5),
{
dat <- data.frame(x = rep(1, rows),
y = 1:rows,
z = cumsum(rnorm(rows)))
bench::mark(
hrec = unname((recipe(formula = formula, data = dat) |>
step_kernel_filter(z, kernel = list(rep(1, 5001L)/5001L), align = "center") |>
plate("tbl"))[10000, "kernel_filter_z"]),
{rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_window(z, size = 5001L, statistic = "mean") |>
recipes::prep() |>
recipes::bake(new_data = NULL)
unname(rec[10000, "z"])},
min_iterations = 1L,
relative = relative,
check = TRUE
)
}
)
#> Running with:
#> rows
#> 1 20000
#> 2 200000
results
#> # A tibble: 4 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 2e4 1 1 83.6 1.78 Inf
#> 2 { rec = recipes::bake(recipes… 2e4 85.6 84.5 1 1 NaN
#> 3 hrec 2e5 1 1 639. 1 NaN
#> 4 { rec = recipes::bake(recipes… 2e5 651. 643. 1 1.50 NaN
step_convolve_gamma
formula <- as.formula(y~x+z)
results <- bench::press(
rows = c(2e4, 2e6),
{
dat <- data.frame(x = rep(1, rows),
y = 1:rows,
z = cumsum(rnorm(rows)))
bench::mark(
hrec = (recipe(formula = formula, data = dat) |>
step_convolve_gamma(z, amplitude = 1, k = 1, theta = 1) |>
plate("tbl")),
min_iterations = 1,
relative = FALSE,
check = TRUE
)
}
)
#> Running with:
#> rows
#> 1 20000
#> 2 2000000
results
#> # A tibble: 2 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec 20000 1.79ms 1.83ms 538. 723.4KB 2.20
#> 2 hrec 2000000 27.15ms 27.56ms 36.3 15.3MB 0
multiple steps
step_harmonic dominates these results.
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = as.numeric(1:rows),
y = 1:rows)
bench::mark(
hrec = recipe(formula = formula, data = dat) |>
step_lead_lag(x, lag = 1:20) |>
step_harmonic(x,
frequency = c(1.0, 2.0, 3.0),
cycle_size = 0.1,
starting_value = 0.0) |>
step_center(x) |>
plate("tbl"),
rec = recipes::recipe(formula = formula, data = dat) |>
recipes::step_lag(x, lag = 1:20, keep_original_cols = TRUE) |>
recipes::step_harmonic(x,
frequency = c(1.0, 2.0, 3.0),
cycle_size = 0.1,
starting_val = 0.0,
keep_original_cols = TRUE) |>
recipes::step_center(x) |>
recipes::prep() |>
recipes::bake(new_data = NULL),
check = FALSE,
relative = relative,
min_iterations = 1
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 15.2 1 1
#> 2 rec 100 15.2 15.2 1 6.44 1.01
#> 3 hrec 10000 1 1 11.2 1 1.02
#> 4 rec 10000 11.2 11.2 1 2.68 1
#> 5 hrec 5000000 1 1 1.22 1 1.22
#> 6 rec 5000000 1.22 1.22 1 2.62 1
step_spline_b
formula <- as.formula(y~x)
n <- c(100, 1e4, 5e6)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows)
bench::mark(
hrec = unname(recipe(formula = formula, data = dat) |>
step_spline_b(x, df = 13) |>
plate("tbl")),
rec = unname(recipes::recipe(formula = formula, data = dat) |>
recipes::step_spline_b(x, deg_free = 13, keep_original_cols = TRUE)|>
recipes::prep() |>
recipes::bake(new_data = NULL)),
check = TRUE,
relative = relative,
min_iterations = 2
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 7.54 2.26 NaN
#> 2 rec 100 7.51 7.49 1 1 Inf
#> 3 hrec 10000 1 1 6.08 1 Inf
#> 4 rec 10000 6.13 6.08 1 4.21 NaN
#> 5 hrec 5000000 1 1 2.63 1 1.05
#> 6 rec 5000000 2.91 2.63 1 4.18 1
step_spline_n
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows)
bench::mark(
hrec = unname(recipe(formula = formula, data = dat) |>
step_spline_n(x, df = 11L) |>
plate("tbl")),
rec = unname(recipes::recipe(formula = formula, data = dat) |>
recipes::step_spline_natural(x, deg_free = 11L, keep_original_cols = TRUE)|>
recipes::prep() |>
recipes::bake(new_data = NULL)),
check = TRUE,
relative = relative,
min_iterations = 2L
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec 100 1 1 7.45 2.95 NaN
#> 2 rec 100 7.45 7.40 1 1 Inf
#> 3 hrec 10000 1 1 5.88 1 Inf
#> 4 rec 10000 5.95 5.88 1 3.99 NaN
#> 5 hrec 5000000 1 1 3.21 1 1
#> 6 rec 5000000 3.01 3.21 1 3.96 1.25
step_add_noise
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = as.numeric(1:rows),
y = rep(0.01, rows))
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_add_noise(y) |>
plate("dt"))
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 3 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100 1.21ms 1.26ms 791. 553.9KB 0
#> 2 hrec1 10000 1.57ms 1.61ms 618. 160.5KB 2.07
#> 3 hrec1 5000000 189.88ms 189.97ms 5.26 76.3MB 0
step_aquifer_grf & step_aquifer_theis
The Theis solution is a subset of the grf solution.
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = as.numeric(1:rows),
y = rep(0.01, rows))
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_aquifer_grf(time = x, flow_rate = y) |>
plate("dt"),
hrec2 = recipe(formula = formula, data = dat) |>
step_aquifer_theis(time = x, flow_rate = y) |>
plate("dt"),
check = TRUE)
}
)
#> Running with:
#> rows
#> 1 100
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 2 10000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 3 5000000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100 1.38ms 1.42ms 704. 566.5KB 2.08
#> 2 hrec2 100 1.48ms 1.51ms 657. 541.1KB 2.08
#> 3 hrec1 10000 2.28ms 2.3ms 433. 160.6KB 0
#> 4 hrec2 10000 2.38ms 2.41ms 414. 83.6KB 2.08
#> 5 hrec1 5000000 623.86ms 623.86ms 1.60 76.3MB 0
#> 6 hrec2 5000000 625.03ms 625.03ms 1.60 38.2MB 0
step_aquifer_theis_aniso
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = as.numeric(1:rows),
y = rep(0.01, rows))
bench::mark(
hrec1 = unname(recipe(formula = formula, data = dat) |>
step_aquifer_theis_aniso(time = x,
flow_rate = y,
distance_x = 0,
distance_y = 100,
hydraulic_conductivity_major = 1e-4,
hydraulic_conductivity_minor = 1e-4) |>
plate("dt")),
hrec2 = unname(recipe(formula = formula, data = dat) |>
step_aquifer_theis(time = x, flow_rate = y,) |>
plate("dt")),
check = TRUE)
}
)
#> Running with:
#> rows
#> 1 100
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 2 10000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 3 5000000
#> a: 0
#> a: 0
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100 1.49ms 1.52ms 647. 635.31KB 0
#> 2 hrec2 100 1.57ms 1.61ms 617. 7.98KB 2.09
#> 3 hrec1 10000 2.39ms 2.42ms 404. 162.39KB 2.19
#> 4 hrec2 10000 2.5ms 2.56ms 390. 85.33KB 0
#> 5 hrec1 5000000 640.75ms 640.75ms 1.56 76.3MB 0
#> 6 hrec2 5000000 635.09ms 635.09ms 1.57 38.15MB 0
step_aquifer_leaky
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = as.numeric(1:rows),
y = rep(0.01, rows))
bench::mark(
hrec1 = unname(recipe(formula = formula, data = dat) |>
step_aquifer_leaky(time = x,
flow_rate = y,
leakage = 100000000) |>
plate("dt")),
hrec2 = unname(recipe(formula = formula, data = dat) |>
step_aquifer_theis(time = x,
flow_rate = y) |>
plate("dt")),
check = TRUE)
}
)
#> Running with:
#> rows
#> 1 100
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 2 10000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 3 5000000
#> a: 0
#> a: 0
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100 1.46ms 1.55ms 648. 572.59KB 4.13
#> 2 hrec2 100 1.56ms 1.6ms 624. 7.98KB 0
#> 3 hrec1 10000 3.21ms 3.29ms 300. 396.84KB 2.07
#> 4 hrec2 10000 2.44ms 2.48ms 402. 85.33KB 0
#> 5 hrec1 5000000 1.33s 1.33s 0.753 190.74MB 0
#> 6 hrec2 5000000 627.7ms 627.7ms 1.59 38.15MB 0
step_aquifer_patch
formula <- as.formula(y~x)
results <- bench::press(
rows = c(1e4, 1e5, 1e6),
{
dat <- data.frame(x = as.numeric(1:rows),
y = rep(0.01, rows))
bench::mark(
hrec1 = (recipe(formula = formula, data = dat) |>
step_aquifer_grf(time = x, flow_rate = y) |>
plate("dt")),
hrec3 = (recipe(formula = formula, data = dat) |>
step_aquifer_patch(time = x,
flow_rate = 0.01,
thickness = 1.0,
radius = 100.0,
radius_patch = 200.0,
specific_storage_inner = 1e-6,
specific_storage_outer = 1e-6,
hydraulic_conductivity_inner = 1e-4,
hydraulic_conductivity_outer = 1e-4,
n_stehfest = 8L
) |>
plate("dt")),
check = FALSE,
relative = relative)
}
)
#> Running with:
#> rows
#> 1 10000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 2 100000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 3 1000000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 hrec1 10000 1 1 53.0 1 Inf
#> 2 hrec3 10000 53.9 53.2 1 4.06 NaN
#> 3 hrec1 100000 1 1 99.8 1.99 NaN
#> 4 hrec3 100000 103. 101. 1 1 NaN
#> 5 hrec1 1000000 1 1 89.6 2.00 NaN
#> 6 hrec3 1000000 91.2 90.7 1 1 NaN
step_aquifer_wellbore_storage
- currently this is slow for long series.
results <- bench::press(
rows = c(1e3, 1e4, 1e5),
{
dat <- data.frame(x = as.numeric(1:rows),
y = as.numeric(1:rows))
bench::mark(
hrec1 = unname(recipe(formula = formula, data = dat) |>
step_aquifer_wellbore_storage(time = x,
flow_rate = 0.01,
hydraulic_conductivity = 1e-4,
specific_storage = 1e-6,
radius = 100,
radius_casing = 1e-15,
radius_well = 1e-15, n_terms = 18) |>
plate("dt")),
hrec2 = unname(recipe(formula = formula, data = dat) |>
step_aquifer_theis(time = x,
flow_rate = y) |>
plate("dt")),
check = FALSE
)
}
)
#> Running with:
#> rows
#> 1 1000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 2 10000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> 3 100000
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
#> a: 0
results
#> # A tibble: 6 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 1000 8.5ms 8.53ms 117. 584.14KB 0
#> 2 hrec2 1000 1.67ms 1.71ms 582. 22.88KB 2.08
#> 3 hrec1 10000 58.68ms 58.77ms 16.9 162.36KB 0
#> 4 hrec2 10000 2.46ms 2.49ms 401. 163.5KB 0
#> 5 hrec1 100000 525.51ms 525.51ms 1.90 1.53MB 0
#> 6 hrec2 100000 9.71ms 9.79ms 101. 1.53MB 0
step_vadose_weeks
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = as.numeric(1:rows),
y = as.numeric(1:rows))
bench::mark(
hrec1 = (recipe(formula = formula, data = dat) |>
step_vadose_weeks(time = x,
air_diffusivity = 0.8,
thickness = 5,
precision = 1e-12) |>
plate("dt")),
check = FALSE,
min_iterations = 2
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 3 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100 1.22ms 1.25ms 800. 557.8KB 0
#> 2 hrec1 10000 1.39ms 1.42ms 701. 160.5KB 2.07
#> 3 hrec1 5000000 181.55ms 181.91ms 5.50 76.3MB 0
step_transport_ogata_banks
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(expand.grid(as.numeric(1:rows),
as.numeric(1:10)))
names(dat) <- c('x', 'y')
bench::mark(
hrec1 = (recipe(formula = formula, data = dat) |>
step_transport_ogata_banks(time = x,
distance = y) |>
plate("dt")),
check = FALSE,
min_iterations = 2
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 3 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100 1.31ms 1.34ms 738. 572KB 2.07
#> 2 hrec1 10000 4.99ms 5.03ms 194. 786KB 0
#> 3 hrec1 5000000 1.5s 1.5s 0.666 381MB 0.666
step_transport_fractures_solute
formula <- as.formula(~time+z+x)
dat <- setDT(expand.grid(10^(3:8),
seq(0.0, 10, 1),
c(0.0)))
names(dat) <- c("time", "z", "x")
results <-
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_transport_fractures_solute(time = time,
distance_fracture = z,
distance_matrix = x) |>
plate("dt"),
check = FALSE,
min_iterations = 2
)
results
#> # A tibble: 1 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 1.73ms 1.77ms 565. 595KB 0
step_transport_fractures_heat
formula <- as.formula(~time+z+x)
dat <- setDT(expand.grid(10^(3:8),
seq(0.0, 100, 1),
c(0.0, 0.05)))
names(dat) <- c("time", "z", "x")
results <-
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_transport_fractures_heat(time = time,
distance_fracture = z,
distance_matrix = x) |>
plate("dt"),
check = FALSE,
min_iterations = 2
)
results
#> # A tibble: 1 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 9.82ms 9.87ms 101. 603KB 0
step_fft_pgram, step_fft_welch
formula <- as.formula(y~x + z)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows), y = rnorm(rows), z = rnorm(rows),
q = rnorm(rows), r = rnorm(rows), s = rnorm(rows))
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_fft_pgram(c(x, y),
3,
TRUE,
TRUE,
FALSE,
0.1,
time_step = 1) |>
prep() |>
bake(),
hrec2 = recipe(formula = formula, data = dat) |>
step_fft_pgram(c(x, y),
3,
TRUE,
TRUE,
TRUE,
0.1,
time_step = 1) |>
prep() |>
bake(),
hrec3 = recipe(formula = formula, data = dat) |>
step_fft_welch(c(x, y),
length_subset = nrow(dat) / 10,
overlap = 0.60,
window = window_nuttall(nrow(dat) / 10),
time_step = 1) |>
prep() |>
bake(),
check = FALSE,
min_iterations = 1
)
}
)
#> Running with:
#> rows
#> 1 100
#> 2 10000
#> 3 5000000
results
#> # A tibble: 9 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100 1.54ms 1.59ms 626. 588.65KB 2.76
#> 2 hrec2 100 1.53ms 1.6ms 626. 17.76KB 0
#> 3 hrec3 100 1.36ms 1.4ms 707. 567.22KB 2.45
#> 4 hrec1 10000 2.15ms 2.8ms 389. 1.45MB 0
#> 5 hrec2 10000 2.46ms 2.51ms 387. 1.15MB 2.01
#> 6 hrec3 10000 2.53ms 2.56ms 389. 268.44KB 0
#> 7 hrec1 5000000 540.55ms 540.55ms 1.85 724.8MB 0
#> 8 hrec2 5000000 445.06ms 445.06ms 2.25 572.21MB 2.25
#> 9 hrec3 5000000 436.09ms 436.09ms 2.29 129.7MB 2.29
step_fft_transfer_welch and step_fft_transfer_pgram, step_fft_transfer_experimental
formula <- as.formula(y~x)
results <- bench::press(
rows = c(1e5, 1e6, 1e7),
{
dat <- data.frame(x = rnorm(rows), y = rnorm(rows))
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_fft_transfer_pgram(c(x, y),
3,
TRUE,
TRUE,
0.1,
time_step = 1) |>
prep() |>
bake(),
hrec2 = recipe(formula = formula, data = dat) |>
step_fft_transfer_welch(c(x, y),
length_subset = nrow(dat) / 10,
overlap = 0.60,
window = window_nuttall(nrow(dat) / 10),
time_step = 1) |>
prep() |>
bake(),
hrec3 <- recipe(formula = formula, data = dat) |>
step_fft_transfer_experimental(c(x, y),
spans = 3,
taper = 0.1,
n_groups = 300,
time_step = 1) |>
prep() |>
bake(),
check = FALSE,
min_iterations = 1
)
}
)
#> Running with:
#> rows
#> 1 100000
#> 2 1000000
#> 3 10000000
results
#> # A tibble: 9 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 1e5 19.16ms 20.27ms 49.5 6.67MB 0
#> 2 hrec2 1e5 9.7ms 10.45ms 96.4 2.62MB 0
#> 3 hrec3 <- bake(prep(step_… 1e5 7ms 7.21ms 133. 2.49MB 0
#> 4 hrec1 1e6 196.66ms 198.68ms 5.03 61.04MB 2.52
#> 5 hrec2 1e6 86.32ms 87.07ms 11.5 20.6MB 0
#> 6 hrec3 <- bake(prep(step_… 1e6 57.56ms 58.85ms 16.8 19.09MB 0
#> 7 hrec1 1e7 2.16s 2.16s 0.463 610.35MB 0.463
#> 8 hrec2 1e7 1s 1s 0.999 206MB 0
#> 9 hrec3 <- bake(prep(step_… 1e7 961.93ms 961.93ms 1.04 190.75MB 1.04
step_ols
formula <- as.formula(y~.)
results <- bench::press(
rows = c(1e5, 1e6, 1e7),
{
dat <- data.frame(
y = rnorm(rows),
x = rnorm(rows),
z = rnorm(rows),
a = rnorm(rows),
b = rnorm(rows),
d = rnorm(rows),
e = rnorm(rows),
f = rnorm(rows),
g = rnorm(rows))
m <- qM(dat)
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_ols(formula = as.formula(y~.),
do_response = FALSE) |>
prep() |>
bake(),
hrec2 = recipe(formula = formula, data = dat) |>
step_ols(formula = as.formula(y~.),
do_response = TRUE) |>
prep() |>
bake(),
lm = lm(y~. - 1, dat),
lm.fit(x = m[, c(2:ncol(dat))], y = m[, 1]),
check = FALSE,
relative = FALSE
)
}
)
#> Running with:
#> rows
#> 1 100000
#> 2 1000000
#> 3 10000000
results
#> # A tibble: 12 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 1e5 6.74ms 7.14ms 124. 17.37MB 4.68
#> 2 hrec2 1e5 7.52ms 7.71ms 127. 19.13MB 2.16
#> 3 lm 1e5 22.04ms 31.19ms 32.8 47.75MB 2.34
#> 4 lm.fit(x = m[, c(2:ncol… 1e5 12.29ms 12.57ms 77.6 17.55MB 2.28
#> 5 hrec1 1e6 54.76ms 57.81ms 16.9 167.85MB 4.21
#> 6 hrec2 1e6 63.87ms 73.94ms 13.6 190.74MB 2.26
#> 7 lm 1e6 161.47ms 196.68ms 5.08 473.4MB 2.54
#> 8 lm.fit(x = m[, c(2:ncol… 1e6 128.76ms 143.06ms 7.15 175.48MB 0
#> 9 hrec1 1e7 634.82ms 634.82ms 1.58 1.64GB 0
#> 10 hrec2 1e7 915.43ms 915.43ms 1.09 1.86GB 1.09
#> 11 lm 1e7 2.33s 2.33s 0.428 4.67GB 1.29
#> 12 lm.fit(x = m[, c(2:ncol… 1e7 1.5s 1.5s 0.665 1.71GB 0.665
# formula <- as.formula(y~x+z)
#
#
# results <- bench::press(
# rows = n,
# {
# dat <- data.frame(x = rnorm(rows),
# y = rnorm(rows),
# z = rnorm(rows))
# bench::mark(
# hrec = recipe(formula = formula, data = dat) |>
# step_intercept() |>
# step_nls(formula = as.formula(y~.)) |>
# prep() |>
# bake(),
# check = FALSE,
# relative = FALSE
# )
# }
# )
step_nls
n0 <- 5e5
n <- 2e4
n2 <- 1e4
b <- cumsum(rnorm(n0))
b <- b - mean(b)
max_t <- 720 * ceiling(2.554)
a <- hydrorecipes:::convolve_overlap_save(x = b,
y = hydrorecipes:::gamma_3(0:max_t, 0.816, 9.221, 2.554),
0)
max_t <- 720 * ceiling(2.554)
dat <- data.frame(a = a, b = b)
formula <- formula(a~b)
# for gsl_nls
f <- function(z, x) {
max_t <- 720 * ceiling(z[3])
hydrorecipes:::convolve_overlap_save(x = x,
y = hydrorecipes:::gamma_3(0:max_t, z[1], z[2], z[3]),
align = 0)[-(1:7200)]
}
results <- bench::mark(
gsl_fun <- unname(round(coef(gsl_nls(
fn = f, ## model function
y = a[-(1:7200)], ## response vector
x = b,
start = c(A = 0.5, n = 2.0, a = 2.0), ## starting values
lower = c(A = 0.01, n = 1.0, a = 1.0),
upper = c(A = 1.0, n = 10.0, a = 10.0),
control = gsl_nls_control(xtol = 1e-8),
trace = FALSE,
algorithm = "lm" ## algorithm
)), 3)),
h_1 = {h = recipe(formula = formula, data = dat) |>
step_convolve_gamma(b, amplitude = 0.5, k = 2.0, theta = 2.0,
varying = list(name = c("amplitude","k", "theta"),
start = c(0.5, 2.0, 2.0),
lower = c(0.01, 1.0, 1.0),
upper = c(1.0, 10.0, 10.0))) |>
step_nls(formula = formula(a~b), n_subset = 1L,
trace = FALSE,
algorithm = "lm",
control = gsl_nls_control(xtol = 1e-8))
h$prep()$bake()
unname(round(coef(h$steps[[3]]$fit), 3))},
h_10 = {h = recipe(formula = formula, data = dat) |>
step_convolve_gamma(b, amplitude = 0.5, k = 2.0, theta = 2.0,
varying = list(name = c("amplitude","k", "theta"),
start = c(0.5, 2.0, 2.0),
lower = c(0.01, 1.0, 1.0),
upper = c(1.0, 10.0, 10.0))) |>
step_nls(formula = formula(a~b), n_subset = 10L,
trace = FALSE,
algorithm = "lm",
control = gsl_nls_control(xtol = 1e-8))
h$prep()$bake()
unname(round(coef(h$steps[[3]]$fit), 3))},
h_100 = {h = recipe(formula = formula, data = dat) |>
step_convolve_gamma(b, amplitude = 0.5, k = 2.0, theta = 2.0,
varying = list(name = c("amplitude","k", "theta"),
start = c(0.5, 2.0, 2.0),
lower = c(0.01, 1.0, 1.0),
upper = c(1.0, 10.0, 10.0))) |>
step_nls(formula = formula(a~b), n_subset = 100L,
trace = FALSE,
algorithm = "lm",
control = gsl_nls_control(xtol = 1e-8))
h$prep()$bake()
unname(round(coef(h$steps[[3]]$fit), 3))},
check = TRUE
)
results
#> # A tibble: 4 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 gsl_fun <- unname(round(coef(g… 1.34s 1.34s 0.748 893MB 0
#> 2 h_1 1.66s 1.66s 0.604 900MB 0
#> 3 h_10 852.53ms 852.53ms 1.17 309MB 0
#> 4 h_100 755.32ms 755.32ms 1.32 250MB 0
step_ols_gap_fill
set.seed(123)
n <- 100000
frm <- formula(x ~ y + z)
x <- cumsum(rnorm(n))
dat <- data.table(x = x, y = x, z = as.numeric(1:n))
dat[, x := x + c(rep(20, n/2), rep(0, n/2))]
dat[, x := x + 3.0 * sin(z * 1/n)]
tmp <- copy(dat$x)
# Set value to NA. These values will be estimated.
dat[60000:70000, x := NA_real_]
dat <- unclass(dat)
bench::mark(
{h = recipe(formula = frm, data = dat) |>
step_find_interval(z, vec = c(0, n/2, n)) |>
step_intercept() |>
step_spline_b(z, df = 4) |>
step_drop_columns(z)
hrec = recipe(formula = frm, data = dat) |>
step_ols_gap_fill(c(x, y, z), recipe = h) |>
prep() |>
bake()},
check = FALSE
)
#> # A tibble: 1 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:> <bch:> <dbl> <bch:byt> <dbl>
#> 1 { h = step_drop_columns(step_splin… 8.13ms 8.2ms 121. 9.41MB 0
check
step_check_spacing
formula <- as.formula(y~x)
results <- bench::press(
rows = n,
{
dat <- data.frame(x = rnorm(rows),
y = 1:rows)
dat[9:50, "x"] <- NA
dat[9L, "y"] <- NA
bench::mark(
hrec1 = recipe(formula = formula, data = dat) |>
step_check_spacing(y) |>
step_check_na(y) |>
prep() |>
bake(),
hrec2 =recipe(formula = formula, data = dat) |>
step_check_spacing(x) |>
step_check_na(x) |>
prep() |>
bake(),
check = FALSE,
relative = FALSE,
min_iterations = 2
)
}
)
#> Running with:
#> rows
#> 1 100000
results
#> # A tibble: 2 × 7
#> expression rows min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <dbl> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 hrec1 100000 3.03ms 3.12ms 297. 3.39MB 2.15
#> 2 hrec2 100000 3.08ms 3.12ms 319. 2.29MB 0
sessionInfo()
#> R version 4.4.3 (2025-02-28)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.2 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
#> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
#> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] splines2_0.5.4 RcppRoll_0.3.1 tibble_3.2.1 bench_1.1.4
#> [5] hydrorecipes_0.0.6 Bessel_0.6-1 data.table_1.17.0 gslnls_1.4.1
#> [9] collapse_2.1.0
#>
#> loaded via a namespace (and not attached):
#> [1] gtable_0.3.6 xfun_0.51 bslib_0.9.0
#> [4] ggplot2_3.5.1 htmlwidgets_1.6.4 recipes_1.2.0
#> [7] lattice_0.22-6 vctrs_0.6.5 tools_4.4.3
#> [10] generics_0.1.3 parallel_4.4.3 pkgconfig_2.0.3
#> [13] Matrix_1.7-2 desc_1.4.3 lifecycle_1.0.4
#> [16] compiler_4.4.3 textshaping_1.0.0 munsell_0.5.1
#> [19] codetools_0.2-20 RcppThread_2.2.0 htmltools_0.5.8.1
#> [22] class_7.3-23 sass_0.4.9 yaml_2.3.10
#> [25] lazyeval_0.2.2 gmp_0.7-5 profmem_0.6.0
#> [28] prodlim_2024.06.25 plotly_4.10.4 pillar_1.10.1
#> [31] pkgdown_2.1.1 jquerylib_0.1.4 tidyr_1.3.1
#> [34] MASS_7.3-64 cachem_1.1.0 gower_1.0.2
#> [37] rpart_4.1.24 parallelly_1.42.0 lava_1.8.1
#> [40] tidyselect_1.2.1 digest_0.6.37 future_1.34.0
#> [43] earthtide_0.1.7 listenv_0.9.1 dplyr_1.1.4
#> [46] purrr_1.0.4 splines_4.4.3 fastmap_1.2.0
#> [49] grid_4.4.3 colorspace_2.1-1 cli_3.6.4
#> [52] magrittr_2.0.3 utf8_1.2.4 survival_3.8-3
#> [55] future.apply_1.11.3 withr_3.0.2 Rmpfr_1.0-0
#> [58] scales_1.3.0 timechange_0.3.0 lubridate_1.9.4
#> [61] rmarkdown_2.29 httr_1.4.7 globals_0.16.3
#> [64] nnet_7.3-20 timeDate_4041.110 ragg_1.3.3
#> [67] evaluate_1.0.3 knitr_1.50 hardhat_1.4.1
#> [70] viridisLite_0.4.2 rlang_1.1.5 Rcpp_1.0.14
#> [73] glue_1.8.0 sparsevctrs_0.3.1 ipred_0.9-15
#> [76] jsonlite_1.9.1 R6_2.6.1 systemfonts_1.2.1
#> [79] fs_1.6.5