The time it takes to knit a book (bookdown) that has a gganimate animated plot in it is quite long, even then re-knitting and having
cache=TRUE in the code chunks. The expected behavior would be that the first time knitting it takes a while, the second time almost nothing.
Below there are a few more benchmarks, but, in brief (using CRAN gganimate):
- The time for a clean knit is ~50s.
- The second knit with
cache=TRUEis ~15s (99% time spent in the final
- Commenting out the animate() part, cached knit time goes down to ~2s
- If I add a second gganimated chunk, clean knit and cached knit times are 2x (~30s when cached; 99% time spent in the final
Weird enough, if I use the Github dev version of gganimate, things are MUCH worse (~170 1st / 110s 2nd knit).
All the code for these tests is in: https://github.com/gorkang/gganimate-bookdown
Posting here before reporting it as a bug, in case I am doing something wrong.
- 48, 50, 55s CRAN version gganimate
- 89, 91s dev version gganimate
A2. 2nd run with CACHE
- 14.5 (99% in pandoc command) CRAN version gganimate
- 57, 58s dev version gganimate
B1. CLEAN commenting animate()
- 2s CRAN version gganimate
- 3.2 dev version gganimate
B2. 2nd run with CACHE commenting animate()
- 1.3s CRAN version gganimate
- 2.5 dev version gganimate
C1. CLEAN 2 anime chunks
- 111s, 108 CRAN version gganimate
- 173s dev version gganimate
C2. 2nd run with CACHE
- 27, 29s CRAN version gganimate
- 110s dev version gganimate