-
Notifications
You must be signed in to change notification settings - Fork 283
Closed
Labels
Description
partial
seems to have a huge computational overhead. I guess you are aware of this and I am not using the package in an intended way but I thought I let you know anyway, since it was quite a surprise to me. A minimal working example demonstrating the problem is
library(tictoc)
library(purrr)
center <- function(x,myMean) return(x-myMean)
centerPartial <- partial(center,myMean=10)
reps <- 10^4
theData <- runif(100)
tic()
for (i in 1:reps){
res <- center(theData,10)
}
toc()
tic()
for (i in 1:reps){
res <- centerPartial(theData)
}
toc()
The second loop is around 100 times slower than the equivalent first loop.