search for: b_wrap

Displaying 1 result from an estimated 1 matches for "b_wrap".

Did you mean: _wrap
2017 Aug 04
2
Why is as.function() slower than eval(call("function"())?
...1950 9.852 100 a # make_fn_2(a, b) 3.541 3.7230 4.13400 3.906 4.1055 23.153 100 b At first I thought the gap was due to the overhead of calling c(a, list(b)). But this turns out not to be the case: make_fn_weird <- function(a, b) as.function(c(a, b), env = parent.frame()) b_wrapped <- list(b) make_fn_weirder <- function(a_b) as.function(a_b, env = parent.frame()) a_b <- c(a, b_wrapped) microbenchmark(make_fn_1(a, b), make_fn_2(a, b), make_fn_weird(a, b_wrapped), make_fn_weirder(a_b)) # Unit: microseconds #...