Relative time
When benchmarking it's important to consider both absolute and relative times.
Using the timings below, on average a single call to read.csv()
is 720 - 80 = 640 milliseconds slower than that of readRDS()
.
> microbenchmark(read.csv("movies.csv"),
readRDS("movies.rds"),
times = 10)
Unit: milliseconds
expr min lq mean median uq neval cld
read.csv("movies.csv") 540 660 680 720 720 740 10 b
readRDS("movies.rds") 70 80 90 80 100 110 10 a
Approximately, how much slower is the mean time of read.csv()
compared to readRDS()
?
This exercise is part of the course
Writing Efficient R Code
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
