search for: neval

Displaying 20 results from an estimated 97 matches for "neval".

Did you mean: eval
2013 Jul 02
2
cache most-recent dispatch
...lt;- selectMethod(paste, class(x[[1]])) sapply(x, paste, collapse="+") } lst <- split(rep(LETTERS, 100), rep(1:1300, 2)) library(microbenchmark) microbenchmark(fun0(lst), times=10) ## Unit: milliseconds ## expr min lq median uq max neval ## fun0(lst) 4.153287 4.180659 4.513539 5.19261 5.280481 10 setGeneric("paste") microbenchmark(fun0(lst), fun1(lst), times=10) ## > microbenchmark(fun0(lst), fun1(lst), times=10) ## Unit: milliseconds ## expr min lq median uq...
2015 Jan 26
2
speedbump in library
...amespaces() f2 <- function(pkg) !is.null(.getNamespace(pkg)) require(microbenchmark) pkg <- "foo"; (mbM <- microbenchmark(r1 <- f1(pkg), r2 <- f2(pkg))); stopifnot(identical(r1,r2)); r1 ## Unit: microseconds ## expr min lq mean median uq max neval cld ## r1 <- f1(pkg) 38.516 40.9790 42.35037 41.7245 42.4060 82.922 100 b ## r2 <- f2(pkg) 1.331 1.8285 2.13874 2.0855 2.3365 7.252 100 a ## [1] FALSE pkg <- "stats"; (mbM <- microbenchmark(r1 <- f1(pkg), r2 <- f2(pkg))); stopifnot(identical(r1,r2)); r1 #...
2017 Aug 04
2
Why is as.function() slower than eval(call("function"())?
...function(c(a, list(b)), env = parent.frame()) a <- as.pairlist(alist(x = , y = )) b <- quote(x + y) library("microbenchmark") microbenchmark(make_fn_1(a, b), make_fn_2(a, b)) # Unit: microseconds # expr min lq mean median uq max neval cld # make_fn_1(a, b) 1.671 1.8855 2.13297 2.039 2.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 <- func...
2018 Mar 13
2
Possible Improvement to sapply
FYI, in R devel (to become 3.5.0), there's isFALSE() which will cut some corners compared to identical(): > microbenchmark::microbenchmark(identical(FALSE, FALSE), isFALSE(FALSE)) Unit: nanoseconds expr min lq mean median uq max neval identical(FALSE, FALSE) 984 1138 1694.13 1218.0 1337.5 13584 100 isFALSE(FALSE) 713 761 1133.53 809.5 871.5 18619 100 > microbenchmark::microbenchmark(identical(TRUE, FALSE), isFALSE(TRUE)) Unit: nanoseconds expr min lq mean median uq max neval...
2018 Feb 11
4
Parallel assignments and goto
...itude slower than the first version. > microbenchmark::microbenchmark(factorial(100), + factorial_tr_1(100), + factorial_tr_2(100)) Unit: microseconds expr min lq mean median uq max neval factorial(100) 53.978 60.543 77.76203 71.0635 85.947 180.251 100 factorial_tr_1(100) 9.022 9.903 11.52563 11.0430 11.984 28.464 100 factorial_tr_2(100) 5870.565 6109.905 6534.13607 6320.4830 6756.463 8177.635 100 Is there another way to do parallel assignmen...
2018 Feb 27
2
Parallel assignments and goto
...ial(1000), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?factorial_tr_manual(1000), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?factorial_tr_automatic_1(1000), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?factorial_tr_automatic_2(1000)) Unit: microseconds ? ? ? ? ? ? ? ? ? ? ? ? ? ?expr ? ? min ? ? ?lq ? ? ?mean ? median ? ? ? ?uq ? ? ?max neval ? ? ? ? ? ? ? ? factorial(1000) 884.137 942.060 1076.3949 977.6235 1042.5035 2889.779 ? 100 ? ? ? factorial_tr_manual(1000) 110.215 116.919 ?130.2337 118.7350 ?122.7495 ?255.062 ? 100 ?factorial_tr_automatic_1(1000) 179.897 183.437 ?212.8879 187.8250 ?195.7670 ?979.352 ? 100 ?factorial_tr_automatic...
2017 Nov 20
2
Small performance bug in [.Date
Hi all, I think there's an unnecessary line in [.Date which has a considerable impact on performance when subsetting large dates: x <- Sys.Date() + 1:1e6 microbenchmark::microbenchmark(x[1]) #> Unit: microseconds #> expr min lq mean median uq max neval #> x[1] 920.651 1039.346 3624.833 2294.404 3786.881 41176.38 100 `[.Date` <- function(x, ..., drop = TRUE) { cl <- oldClass(x) # class(x) <- NULL val <- NextMethod("[") class(val) <- cl val } microbenchmark::microbenchmark(x[1]) #> Unit: micros...
2018 Mar 13
4
Possible Improvement to sapply
...nswer) <- X if (simplify && length(answer)) simplify2array(answer, higher = (simplify == "array")) else answer } > microbenchmark(sapply(myList, length), times = 10000L) Unit: microseconds expr min lq mean median uq max neval sapply(myList, length) 14.156 15.572 16.67603 15.926 16.634 650.46 10000 > microbenchmark(mySapply(myList, length), times = 10000L) Unit: microseconds expr min lq mean median uq max neval mySapply(myList, length) 13.095 14.864 16.02964 15.218 15.573 167...
2018 Feb 26
0
Parallel assignments and goto
...ean ? median ? ? ? ? ? ? ? ? factorial(1000) 756.357 810.4135 963.1040 856.3315 ? ? ? factorial_tr_manual(1000) 104.838 119.7595 198.7347 129.0870 ?factorial_tr_automatic_1(1000) 112.354 125.5145 211.6148 135.5255 ?factorial_tr_automatic_2(1000) 461.015 544.7035 688.5988 565.3240 ? ? ? ?uq ? ? ?max neval ?945.3110 4149.099 ? 100 ?136.8200 4190.331 ? 100 ?152.9625 5944.312 ? 100 ?600.5235 7798.622 ? 100 The simple solution, of course, is to not do that, but then I can?t handle expressions inside calls to ?with?. And I would really like to, because then I can combine tail recursion with pattern matc...
2018 Feb 27
0
Parallel assignments and goto
...factorial_tr_manual(1000), > factorial_tr_automatic_1(1000), > factorial_tr_automatic_2(1000)) > Unit: microseconds > expr min lq mean median > uq max neval > factorial(1000) 884.137 942.060 1076.3949 977.6235 > 1042.5035 2889.779 100 > factorial_tr_manual(1000) 110.215 116.919 130.2337 118.7350 > 122.7495 255.062 100 > factorial_tr_automatic_1(1000) 179.897 183.437 212.8879 187.8250 > 195.7670 979.352...
2024 Feb 29
2
[External] converting MATLAB -> R | element-wise operation
...w = 2, byrow = TRUE) # Example matrix lambda <- c(2, 3, 4) # Example vector colNN <- t(NN) microbenchmark( sweep = sweep(NN, 2, lambda, "/"), transpose = t(t(NN)/lambda), colNN = colNN/lambda ) Unit: nanoseconds expr min lq mean median uq max neval cld sweep 13817 14145 15115.06 14350 14657.5 75932 100 a transpose 1845 1927 2151.68 2132 2214.0 7093 100 b colNN 82 123 141.86 123 164.0 492 100 c Note that transpose is much faster than sweep because it is doing less work, I believe essentially just c...
2017 Aug 22
4
How to benchmark speed of load/readRDS correctly
...> microbenchmark( + n <- readRDS('file.rds'), + load('file.Rdata') + ) Unit: milliseconds expr min lq mean median uq max neval n <- readRDS(fl1) 106.5956 109.6457 237.3844 117.8956 141.9921 10934.162 100 load(fl2) 295.0654 301.8162 335.6266 308.3757 319.6965 1915.706...
2005 May 09
2
use "integrate" for functions defined in C, not R
..._dqags", I define a C function "my_call_dqags" that has it's own parameters of "lower, upper" and etc define in C, instead of parsing from R. And I call Rdqags(Cintfn, &lower, &upper, &epsabs, &epsrel, &result, &abserr, &neval, &ier, &limit, &lenw, &last, iwork, work); instead of Rdqags(Rintfn, (void*)&is, &lower, &upper, &epsabs, &epsrel, &result, &abserr, &neval, &ier, &limit, &lenw, &last, iwork, work); I am not passing (void*)&a...
2020 Nov 02
3
parallel PSOCK connection latency is greater on Linux?
...DELAY causes many small packets to be sent, it might make more sense to set TCP_QUICKACK instead. I?aki > Unit: microseconds > expr min lq mean median uq max > clusterEvalQ(cl, iris) 1449.997 43991.99 43975.21 43997.1 44001.91 48027.83 > neval > 1000 > > exactly the same machine + R but with TCP_NODELAY enabled in R_SockConnect(): > > Unit: microseconds > expr min lq mean median uq max neval > clusterEvalQ(cl, iris) 156.125 166.41 180.8806 170.247 174.298 5322.234 1000 &g...
2018 Mar 14
0
Possible Improvement to sapply
...ites: > FYI, in R devel (to become 3.5.0), there's isFALSE() which will cut > some corners compared to identical(): > > microbenchmark::microbenchmark(identical(FALSE, FALSE), isFALSE(FALSE)) > Unit: nanoseconds > expr min lq mean median uq max neval > identical(FALSE, FALSE) 984 1138 1694.13 1218.0 1337.5 13584 100 > isFALSE(FALSE) 713 761 1133.53 809.5 871.5 18619 100 > > microbenchmark::microbenchmark(identical(TRUE, FALSE), isFALSE(TRUE)) > Unit: nanoseconds > expr min lq mean...
2018 Mar 13
1
Possible Improvement to sapply
...fy2array(answer, higher = (simplify == "array")) > > else answer > > } > > > > > >> microbenchmark(sapply(myList, length), times = 10000L) > > Unit: microseconds > > expr min lq mean median uq max > neval > > sapply(myList, length) 14.156 15.572 16.67603 15.926 16.634 650.46 > > 10000 > >> microbenchmark(mySapply(myList, length), times = 10000L) > > Unit: microseconds > > expr min lq mean median uq max > neval > >...
2004 Nov 18
0
Calling Rdqags doesn't produce correct result.
...m for numerical integration. Following are the C program and the corresponding R program: C program --------- void test(double *a, double *b, double *epsabs, double *epsrel, double *result, double *abserr, int *neval, int *ier, int *limit, int *lenw, int *last, int *iwork, double *work, double *exx) { void *ex; ex = exx; Rdqags(tmpfun, ex, a, b, epsabs, epsrel, result, abserr, neval...
2015 Jan 26
2
speedbump in library
...tNamespace(pkg)) >> >> require(microbenchmark) >> >> pkg <- "foo"; (mbM <- microbenchmark(r1 <- f1(pkg), r2 <- >> f2(pkg))); stopifnot(identical(r1,r2)); r1 ## Unit: >> microseconds ## expr min lq mean median uq max neval cld >> ## r1 <- f1(pkg) 38.516 40.9790 42.35037 41.7245 42.4060 >> 82.922 100 b ## r2 <- f2(pkg) 1.331 1.8285 2.13874 2.0855 >> 2.3365 7.252 100 a ## [1] FALSE >> >> pkg <- "stats"; (mbM <- microbenchmark(r1 <- f1(pkg), r2...
2020 Nov 01
2
parallel PSOCK connection latency is greater on Linux?
I'm exploring latency overhead of parallel PSOCK workers and noticed that serializing/unserializing data back to the main R session is significantly slower on Linux than it is on Windows/MacOS with similar hardware. Is there a reason for this difference and is there a way to avoid the apparent additional Linux overhead? I attempted to isolate the behavior with a test that simply returns
2018 Mar 13
0
Possible Improvement to sapply
...mp; length(answer)) > simplify2array(answer, higher = (simplify == "array")) > else answer > } > > >> microbenchmark(sapply(myList, length), times = 10000L) > Unit: microseconds > expr min lq mean median uq max neval > sapply(myList, length) 14.156 15.572 16.67603 15.926 16.634 650.46 > 10000 >> microbenchmark(mySapply(myList, length), times = 10000L) > Unit: microseconds > expr min lq mean median uq max neval > mySapply(myList, length) 13.095 1...