-
Notifications
You must be signed in to change notification settings - Fork 83
Closed
Description
For example:
library(fs)
system.time({
for (i in 1:1000) file_exists('DESCRIPTION')
})
#> user system elapsed
#> 0.523 0.016 0.539
system.time({
for (i in 1:1000) file.exists('DESCRIPTION')
})
#> user system elapsed
#> 0.002 0.001 0.003
Similarly, replacing an instance of dir_copy
with equivalent base code results in a significant speedup. For this test, the time spent in the copying code went from 370ms to 10ms. This is a real-world case where the speed impact is noticeable. rstudio/sass#53
It is harder to get the code right with base functions, so it would be nice to use fs.
Sorry this isn't more specific about exactly which operations are slow. However, when I profiled it, it looked like a lot of time for file_exists
was spent dealing with tibbles. (Note that it had to be profiled on R 3.6, since the profiler in R 4.0 has a bug and doesn't generate useful data.)
Metadata
Metadata
Assignees
Labels
No labels