Skip to content

perf(export): ignore Java-only changes when deciding whether an export model is affected - #1548

Closed
joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:perf/export-ignore-java-deltas
Closed

joaodinissf wants to merge 1 commit into
dsldevkit:masterfrom
joaodinissf:perf/export-ignore-java-deltas

Conversation

@joaodinissf

Copy link
Copy Markdown
Collaborator

For discussion. This stops Java-only changes from re-queuing and regenerating .export files (part of #1545).

What changed

Since #1405, Export is an Xbase language. Its resource descriptions (XbaseResourceDescriptionManager) record the JVM types of the inferred model as imported names, and those include the downstream EMF interfaces that come from genModelUtil.instanceClassName. Any JDT change to those interfaces therefore marks every .export that uses them as affected. The .export is then re-linked, re-inferred and regenerated. That generated Java is recompiled, and the build does another round. Before #1405, .export files imported no Java names and were never re-queued by Java changes.

A new ExportResourceDescriptionManager (bound in ExportRuntimeModule) drops java:/ deltas before the isAffected checks. Deltas from ecore/genmodel resources and from other DSL files are still honoured.

Why this should be safe. The generated Java is built from genmodel data: instanceClassName is a string, and typeRef(String) only prints that name. It does not depend on what the Java type contains.

Trade-off. Suppose a Java interface is renamed or removed without a genmodel change. The .export is then not regenerated, and its generated Java shows a compile error, as it did before #1405. An unresolved-type marker on the .export stays until the file is touched or a clean build runs.

Verification

  • Per Java-only branch switch on a synthetic workspace (M, stock builder): .export re-processed 2 → 0, files written 260 → 205 (.java 32 → 22), allocation −9%.
  • Control. A branch switch that changes an .ecore / .genmodel still re-processes the dependent .export, .scope and .xtend files (3 / 8 / 16), exactly as on master except the Java-triggered one. 0 errors.
  • No effect with DDK's builder runtime (ClusteringModule), which does not re-queue these files to begin with.
  • Tests. Full reactor verify green: 366 tests (0 failures, 2 skipped), 0 Checkstyle violations, PMD clean; the 14 export tests pass.
  • Pending. A before/after timing on the affected Windows machine. This stays a draft until that is in.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LgVRfQCTxSDwGrN8J5s6fd

Since the Xbase migration (dsldevkit#1405) the Export language uses the default
XbaseResourceDescriptionManager. Its descriptions record, as imported
names and outgoing references, the JVM types of the inferred model -
including the EMF interfaces of the exported EClasses (parameter types
from GenModelUtilX.instanceClassName) and all their super interfaces.
JDT deltas for those types (JavaChangeQueueFiller -> JdtQueuedBuildData
-> pending deltas of the builder) therefore mark every export model
referencing them as affected, so a branch switch that only changes Java
files re-processes and recompiles export models; before dsldevkit#1405 it never
did.

Bind an ExportResourceDescriptionManager that drops java:/ deltas before
the affectedness check. The generated code depends only on the EMF model
(ecore and genmodel), whose deltas still affect export models, as they
did before dsldevkit#1405.

PROTOTYPE: not for review; to be measured with the branch-switch
benchmark.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* <p>
* The inferred JVM model of an export model references the Java interfaces of the exported EClasses, so the Xbase
* description manager records them as imported names and outgoing references. The builder then re-processes every export
* model whenever JDT reports a structural change to one of those interfaces, although the generated code only depends

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for sure not true, export language can use java classes at will from extensions. For example:

extension com::foo::^export::Bar

and the

export lookup x::TypeN as qualified name [isBlaBla(this.eContainer)]{
object-fingerprint;
}

where isBlaBla is defined in com.foo.exportBar

@joaodinissf

joaodinissf commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

@rubenporras: you're right that export models depend on Java beyond the EMF model, so the premise of this PR (and its Javadoc) is wrong. I dug into what that means for rebuilds:

So I'm closing this PR. The merged #1546 and #1547 carry the measurable gains.

🤖 Generated with Claude Code

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.

2 participants