Skip to content

Add opt-in incremental builds (--incremental) - #1659

Open
vadi2 wants to merge 4 commits into
FHIR:masterfrom
vadi2:incremental-builds-v2
Open

vadi2 wants to merge 4 commits into
FHIR:masterfrom
vadi2:incremental-builds-v2

Conversation

@vadi2

@vadi2 vadi2 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Description:

Adds opt-in incremental builds (--incremental, or SUSHI_INCREMENTAL=1). Unchanged files reuse their cached import, and unchanged entities whose lookups still give the same answers replay their cached export. Output and error/warning counts match a normal build. Without the option, nothing changes.

In a large R5 IG (511 FSH files, 676 exports):

Build Time
Normal build (SUSHI 3.21.0) 16.8 s
First incremental build 18.6 s
No change, or a one-file edit 3.2-3.3 s
sushi-config.yaml change 15.7 s

The cache lives in <project>/.sushi-cache, or SUSHI_CACHE_DIR. It is keyed on the SUSHI build, Node version, CLI options, config, dependencies and predefined resources. Anything unexpected abandons the replay and exports normally. Most of the diff is new code under src/incremental/; the exporters only gain hooks that do nothing unless the option is on.

Three commits, best reviewed in order: a no-behaviour-change refactor, import reuse, export replay. This replaces #1655-#1658.

Testing Instructions:

Run sushi . --incremental twice; the second run reports Incremental build: reused N of N files, M of M exports. Edit a file, run again, and compare fsh-generated/ with a build without the option.

Related Issue:

#544

vadi2 and others added 4 commits October 29, 2026 19:14
Preprocessing now extracts each document's aliases and parameterized
RuleSets before applying them, entity name checks share one helper, and
Package lists its fish candidates in one place. No behaviour change.
With --incremental or SUSHI_INCREMENTAL=1, each file's import is cached
by content hash with the aliases, RuleSets and duplicate names it used,
and reused while those are unchanged. Export runs as before.
Each SD, ValueSet, CodeSystem and Instance export is recorded with what
it read and did, and replayed while those reads give the same answers.
Anything unexpected abandons the replay and exports everything again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant