8000 performance decrease · Issue #35 · r-lib/memoise · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

performance decrease #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
harvey131 opened this issue Mar 1, 2017 · 1 comment
< A0EB div class="d-flex flex-row flex-items-center min-width-0">
Closed

performance decrease #35

harvey131 opened this issue Mar 1, 2017 · 1 comment

Comments

@harvey131
Copy link

I have noticed a performance decrease between version 1.0.0 from cran and 1.0.0.9001 from github using R 3.3.2 (2016-10-31)

In this example, the median time of the memoised function doubled.

x= data.frame(x=1:100000, y=1:100000)
f <- function (i) { x[x[,1]==i,2] }
f2  = memoise::memoise(f)
microbenchmark::microbenchmark( f(50), f2(50) )

# mran ‘1.0.0’
Unit: microseconds
expr     min       lq       mean   median      uq      max neval
f(50)  681.561 741.7170 1020.15498 840.9110 856.430 4976.026   100
f2(50)  71.997  75.3565   92.76033  84.4765  88.796  969.864   100

# github ‘1.0.0.9001’
microbenchmark::microbenchmark( f(50), f2(50) )
Unit: microseconds
expr     min       lq      mean  median        uq      max neval
f(50)  799.953 813.8725 1038.1763 834.031 1372.7195 1878.610   100
f2(50) 151.352 158.7115  170.9893 166.391  175.9905  263.345   100
@jimhester
Copy link
Member

The CRAN version evaluates all arguments, even if they were not explicitly used, which causes issues when functions use missing() for example #19.

The current master uses match.call() to only evaluate default arguments and those actually used in the call, which has additional runtime overhead, but deals with the missing() case correctly.

I removed one statement that is no longer required (1b75a6f) and should improve performance a little, but there isn't anything that can be done in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0