Time spend calling pandoc using bookdown::book_render much greater than using rmarkdownn::render

Hi community,

I've been using bookdown recently. I notice that it takes much more time to render a rmarkdown as a bookdown::gitbook than rendering it as a self-contained html_document using rmarkdown::render. This can be up to three times longer for big projects. This may be expected as it needs to loop over the different sections, but I would like to know if there are bad practices to avoid.

I made a reproductible example with an artificial markdown rendered using two different yaml header, one for bookdown and one for rmarkdown. With this example it takes 35% more time on my machine to render using bookdown.

This consists of the following cell copied/pasted 30 times:

library(dplyr)
numer_of_point <- 2000
num_plots <- 10
data_t <- data.table::data.table(a=seq(1:numer_of_point),b=seq(1:numer_of_point), c=as.character(seq(1:numer_of_point)%%10))
p<- plotly::plot_ly(data=data_t,x=~a,y=~b,color=~c,type = "scatter", mode = "lines")
p
p
p
p
p
p
p
p
p
p
p

I used the following header of the rmarkdown :

---
title: "html_document - test"
author: '`r Sys.getenv("USER")`'
date: '`r Sys.Date()`'
output:
 html_document:
    code_download: true
    code_folding: hide
    toc: true
    number_sections: true
    self_contained: false
    toc_float:
      collapsed: false
      smooth_scroll: false
knitr_params:
 warning: FALSE
 message: FALSE
 out.width: "100%"
 fig.height: 6
 fig.width: 18
---

And the following for the bookdown :

---
title: "bookdown_test"
author: '`r Sys.getenv("USER")`'
date: '`r Sys.Date()`'
site: bookdown::bookdown_site
output:
 bookdown::gitbook:
  code_folding: hide
  split_by: section
  self_contained: false
  config:
   search: false
   info: false
   toc:
    collapse: section
   download: ["html"]
   sharing: false
knitr_params:
 warning: FALSE
 message: FALSE
 out.width: "100%"
 fig.height: 6
 fig.width: 18
---

Any opinion on this topic or idea to reduce the bookdown rendering time would be much appreciated as it is becoming a blocker for big projects (where it takes me up to 40min to render). Thanks!

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.