Skip to content

perf(types-builder): reuse vjsf layout for compiledLayout export#44

Merged
BatLeDev merged 4 commits into
mainfrom
perf-types-builder-reuse-compiled-layout
Jul 20, 2026
Merged

perf(types-builder): reuse vjsf layout for compiledLayout export#44
BatLeDev merged 4 commits into
mainfrom
perf-types-builder-reuse-compiled-layout

Conversation

@BatLeDev

@BatLeDev BatLeDev commented Jul 2, 2026

Copy link
Copy Markdown
Member

A schema exporting both vjsf and compiledLayout compiled and serialized its layout twice. The vjsf compiler already produces the serialized compiled layout, so via its new compileParts() the vjsf export caches it per locale and the compiledLayout export reuses it instead of compiling again. Output is byte-identical.

Why: on portals build-types the schema that exports both (page-config-simple) was ~half of the remaining build time, and its second compile+serialize was pure duplication (~7s).

@koumoul/vjsf-compiler 1.5.0 (which adds compileParts) is published, so this no longer waits on anything. The peer dependency of types-builder, the root dev dependency and the lockfile are all bumped to it — bumping only the peer dependency left npm ci resolving 1.2.3 and the build failing with compileParts is not a function. The bump also regenerates the vjsf-site-patch.vue fixture, whose i18n messages changed with the new compiler.

The reuse path had no coverage, so the site-patch fixture now exports compiledLayout alongside vjsf, and a test asserts the emitted compiledLayout is exactly the layout embedded in the generated vjsf component. Note that this test would also pass on main: it guards the invariant the reuse relies on, it does not by itself prove the reuse happened.

A schema exporting both `vjsf` and `compiledLayout` compiled and serialized
its layout twice. The vjsf compiler now exposes the serialized compiled layout
via compileParts(), so cache it per locale during the vjsf export and reuse it
for the compiledLayout export instead of compiling again. Output is byte-identical.

Requires @koumoul/vjsf-compiler >=1.5.0 (compileParts); peer dependency bumped.
@BatLeDev
BatLeDev marked this pull request as draft July 2, 2026 09:24
@BatLeDev
BatLeDev force-pushed the perf-types-builder-reuse-compiled-layout branch from 8cc1a84 to 13ad450 Compare July 2, 2026 09:46
@BatLeDev BatLeDev changed the title perf(types-builder): reuse the vjsf-compiled layout for the compiledLayout export perf(types-builder): reuse vjsf layout for compiledLayout export Jul 2, 2026
BatLeDev added 3 commits July 20, 2026 16:12
The types-builder peer dependency was raised to ^1.5.0 for `compileParts()`,
but the root dev dependency and the lockfile still resolved 1.2.3, so an
`npm ci` install made the build fail with `compileParts is not a function`.

Regenerates the vjsf test fixture, whose i18n messages changed with the
new compiler.
The site-patch fixture now exports compiledLayout alongside vjsf, which
exercises the layout reuse path, and a test asserts the emitted
compiledLayout is byte-identical to the one embedded in the vjsf component.
@BatLeDev
BatLeDev marked this pull request as ready for review July 20, 2026 14:25
@BatLeDev
BatLeDev merged commit 53f5ba7 into main Jul 20, 2026
@BatLeDev
BatLeDev deleted the perf-types-builder-reuse-compiled-layout branch July 20, 2026 14:26
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