From 00e5de525bde5d0d77d9553c6126908f2fdfde20 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 15 Feb 2026 14:14:32 +0200 Subject: Improve --generate performance with incremental builds (62s -> 2s) Add mtime-based skip logic to avoid regenerating unchanged files: - generate::fromgmi skips .gmi files where all outputs are newer - template::_generate_file skips templates when output is fresh - Diff-before-overwrite in templates, gemfeed, and notes indexes to preserve mtimes and prevent cascading cache invalidation - Global dependency check (.lastgen sentinel) for header/footer/CSS - Job throttling via wait -n capped at nproc cores - Add --force flag and FORCE_REBUILD env var to bypass skip logic - Fix misleading atom feed "empty cache" log message Co-Authored-By: Claude Opus 4.6 --- lib/notes.source.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/notes.source.sh') diff --git a/lib/notes.source.sh b/lib/notes.source.sh index bdea5fc..85bd2b5 100644 --- a/lib/notes.source.sh +++ b/lib/notes.source.sh @@ -41,5 +41,10 @@ That were all notes. Hope they were useful! => ../ Go back to main site NOTES - mv "$notes_dir/index.gmi.tmp" "$notes_dir/index.gmi" + # Only overwrite if content changed, preserving mtime for template skip logic + if [[ -f "$notes_dir/index.gmi" ]] && diff -q "$notes_dir/index.gmi.tmp" "$notes_dir/index.gmi" >/dev/null 2>&1; then + rm "$notes_dir/index.gmi.tmp" + else + mv "$notes_dir/index.gmi.tmp" "$notes_dir/index.gmi" + fi } -- cgit v1.2.3