r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
500 stars 137 forks source link

Rewrite `zap_srcref()` in C #1567

Closed lionel- closed 1 year ago

lionel- commented 1 year ago

Closes #1513.

@wch could you try this branch out and see if it fixes your performance issues please?

wch commented 1 year ago

This does indeed speed up the startup time for shiny app I was testing before.

A simple benchmark without shiny:

library(rlang)
system.time({
  for (i in 1:1000) {
    zap_srcref(lm)
  }
})

Results with CRAN version:

   user  system elapsed 
  0.891   0.015   0.910 

Results with this PR:

   user  system elapsed 
  0.017   0.001   0.017