Questions about freezing behavior #3661
Replies: 4 comments 5 replies
-
No answer, but I had the same idea: #3674 |
Beta Was this translation helpful? Give feedback.
-
I think we have a misconception about what freeze is about. Which means for example, within a "prose" only website, with new content comes extra rendering time. If I am not mistaken, this means there is a "missing" feature allowing the user to not render at all to HTML if there is no reason, i.e., not only the content of the "page" but any Quarto component involved in that page such as navbar, footer, etc. |
Beta Was this translation helpful? Give feedback.
-
I am going to quote @cscheid (#3674 (comment)):
|
Beta Was this translation helpful? Give feedback.
-
I'm confused as how to address the original question. I put the following in my project
However, when I do Maybe I'm misunderstanding the purpose of the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
(This is all with Quarto 1.3.49 on macOS Ventura)
This might be me just misunderstanding what freezing does, but I'm running into slower site building times even with freeze enabled because Quarto works through all 100+ qmd files in one of my projects when I run
quarto render
at the terminal, even though nothing has changed in the source code.It might also be that I'm misinterpreting what Quarto means by "render" when compared to other systems like blogdown. Blogdown has an argument in its
build_site()
function that filters the list of Rmd files to re-knit.build_site(build_rmd = 'md5sum')
, for instance, will keep track of the MD5 checksums of all the Rmd files and only re-knit those that have changed. In their documentation, they call this "rendering"—any files that aren't modified don't even get looked at when the site is building.In the documentation for Quarto's freeze, it also talks about selectively re-rendering documents, but in practice, rendering seems to refer to running computational chunks, not converting markdown to HTML/PDF/whatever. As a result, from what I see when I build projects, Quarto still loops through every qmd file and reconverts them to HTML/PDF/etc., but skips the computational output stored in
_freeze
Here's a reproducible illustration of what I'm talking about to clarify things. It's based on this zipped up mini website: blog-example.zip.
freeze: true
is enabled in_quarto.yml
.Initial project building before
_freeze
existsRunning
quarto render
for the first time loops through all 5 .qmd files in the project and runs their chunks through R. Quarto stores the output and some corresponding JSON in the_freeze
folder at the root of the project, as expected:Terminal output from
quarto render
, showing 5 documents getting renderedThat's great and what I expected.
Project building after modifying one frozen file
If I modify
posts/first-post/index.qmd
(add a space or newline or text or something somewhere in it) and then runquarto render
, I would expect Quarto to only re-render that file. Instead, Quarto works through all five qmd files. The computations from the unmodified files aren't run again and Quarto only re-knits the single modified file, but still goes through the effort of checking all the other files and converting them from (q)md to HTML:Terminal output from
quarto render
, showing 1 document getting re-knit and the other 4 getting re-builtIf I run
quarto render
again immediately after, with no file modifications, Quarto still works through all 5 documents:Terminal output from
quarto render
, showing no documents getting re-knit, but all 5 are re-convertedThis is where I'm likely conflating Quarto's freezing with blogdown's MD5 filtering. In blogdown, only the one modified file would be both reknitted and converted to HTML—all the other files would be ignored and not even looped through.
And this is where the site-building slowdown is happening for me. In a project I have with 100+ qmd files, Quarto works through each individually. Chunk computation doesn't happen again if the files are unmodified, but it takes a couple minutes to check and rebuild each of the files, even though nothing has changed.
But maybe this is what freezing is designed to do? It keeps track of changes so that computational chunks don't have to be rerun, but the overall pandoc conversion to HTML still seems to happen every time?
Project previewing after modifying one frozen file
What also might be confusing me about what freezing is supposed to do is what happens when using
quarto preview
. With the ongoing reproducible mini site example, runquarto preview
in the terminal and make a small change inposts/second-post/index.qmd
. Quarto will automatically rerender the site, but this time it will only work through a list of two qmd files: the modified blog post file and the listings page. All other files are untouched.Terminal output from
quarto preview
, showing two documents getting re-rendered after one is modifiedThis behavior is what I think I've been expecting freezing to do—that Quarto would only work through a list of modified files (in this case 2) instead of a list of all the files (in this case 5)
General overarching question
Is there a way to get Quarto to only re-convert (or loop through) modified files, similar to what happens with
quarto preview
? That is, is there some way to make it so that if I modify one file, like a blog post,quarto render
will only deal with 2 files instead of all 5? Like, if I modifyposts/second-post/index.qmd
and runquarto render
, the output would look like this:?Beta Was this translation helpful? Give feedback.
All reactions