Skip to content

Computational Overhead Partial #715

@karchjd

Description

@karchjd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    adverb 📚bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions