Optimise recording deps on new items #1028
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When an item is added, Nanoc generates a dependency of all items onto this new item. This is done because Nanoc can‘t accurately infer whether a newly added item will cause an existing item to need recompilation. This approach is crude and definitely something I’d like to improve, but at the same time it is also correct, which for me is the most important bit.
Unfortunately, radically changing the directory structure of a site means that dependency generation blows up. While Nanoc is apparently doing nothing (right after Compiling…), it is generating all these dependencies, which takes minutes. On top of that, all these artificially new dependencies make memory usage increase up to the point where my laptop cannot handle it anymore.
This fix: Mark new items as “new”, and when looking up all objects that can cause the outdatedness of a given item, return a single new item (because that’s enough to trigger outdatedness). Do not generate any artificial dependencies.
A longer-term solution would be to introduce a mechanism for determining more reliably whether or not the addition of an item might cause an given item to become outdated.