Improving Dendron publish performance

Moving to Dendron's Next.js-based publishing workflow (publishing v3) brings some navigation improvements, sitemaps, a refreshed UI and rendering more consistent with the in-editor preview. Unfortunately it also brings with it a major slowdown in publishing (from ~2m to ~10m in my case).

Parked

As build times haven't substantially worsened even as I've amassed 2.5k of individual notes I can't justify spending any more time improving this. Publish job runs are consistently between 4-7 minutes.

To do

  • Move this site's publishing to GitHub Actions (to avoid additional Netlify spend)
  • Identify where time is spent (enable timestamps in Actions view, time locally)
  • Make each of the following changes and time it again:
    • Try to cache the .next directory, having dendron publish init attempt to pull it before deleting the directory and cloning again (dendronhq/dendron#2162)
    • Try to keep the Next.js cache directory around to speed up export (in workflow)
    • Look at whether dendron publish export --noBuild actually works, given that it runs the build script in export
    • Only load the source diagram file once per run
    • Try to cache exported *.drawio files

Where time's spent

GitHub Actions

  • ~2s: Set up job
  • ~1s: Checkout
  • <1s: Setup node
  • ~2m: Install npm dependencies
  • <1s: Set site URL
  • Build
    • ~2m: dendron publish init
    • ~40s: dendron publish build
    • ~1m: dendron-publish-drawio
    • ~2m: dendron publish export --noBuild
  • ~15s: Publish

Locally (sm0l (Private))

Before:

  • Build:
    • 1m18.021s: dendron publish init
    • 0m5.785s: dendron publish build
    • 1m13.058s: dendron-publish-drawio
    • 0m37.022s: dendron publish export --noBuild

After:

  • Build:
    • 0m3.088s-0m11.994s: dendron publish init
    • 0m5.785s: dendron publish build
    • 1m13.058s: dendron-publish-drawio
    • 0m17.763s: dendron publish export --noBuild