Why does using a function namespace drastically increase overhead?

Viewed 20

Example:

time <- Sys.time()
total <- 0
for(i in 1:1e6) {
  total <- total + stats::pnorm(i/1e6)
}
print(Sys.time() - time)

Time difference of 8.703019 secs

time <- Sys.time()
total <- 0
for(i in 1:1e6) {
  total <- total + pnorm(i/1e6)
}
print(Sys.time() - time)

Time difference of 1.291625 secs

0 Answers
Related