Skip to content

perf: add a cache adapter which adapts only its resource - #1631

Merged
rubenporras merged 1 commit into
dsldevkit:masterfrom
rubenporras:perf/resource-only-cache-adapter
Nov 12, 2026
Merged

rubenporras merged 1 commit into
dsldevkit:masterfrom
rubenporras:perf/resource-only-cache-adapter

Conversation

@rubenporras

Copy link
Copy Markdown
Member

Xtext's OnChangeEvictingCache.CacheAdapter is an EContentAdapter: the first cache access on a resource attaches it to every object in the resource, and attaching it calls getContents(), which may load the resource or install its derived state. Any change of any object then clears the whole resource cache.

ResourceOnlyCacheAdapter adapts only the resource. It is cleared explicitly and on changes of the resource itself (root contents, load state, URI), not on changes of its objects. Since OnChangeEvictingCache uses the cache adapter already on a resource, it must be installed before the first cache access; IndexingInstaller installs it on the resources added to a resource set while it is indexing. Nothing in DDK uses it, so it only takes effect where a client adds the installer.

ResourceCache.getStatistics reads the fields from CacheAdapter so that it also works for subclasses.

Assisted-by: GitHub Copilot (Claude Opus 5.5)

Xtext's OnChangeEvictingCache.CacheAdapter is an EContentAdapter: the
first cache access on a resource attaches it to every object in the
resource, and attaching it calls getContents(), which may load the
resource or install its derived state. Any change of any object then
clears the whole resource cache.

ResourceOnlyCacheAdapter adapts only the resource. It is cleared
explicitly and on changes of the resource itself (root contents, load
state, URI), not on changes of its objects. Since OnChangeEvictingCache
uses the cache adapter already on a resource, it must be installed
before the first cache access; IndexingInstaller installs it on the
resources added to a resource set while it is indexing. Nothing in DDK
uses it, so it only takes effect where a client adds the installer.

ResourceCache.getStatistics reads the fields from CacheAdapter so that
it also works for subclasses.

Assisted-by: GitHub Copilot (Claude Opus 5.5)
@rubenporras
rubenporras force-pushed the perf/resource-only-cache-adapter branch from 7201b70 to 64da624 Compare November 12, 2026 16:49
@rubenporras
rubenporras added this pull request to the merge queue Nov 12, 2026
Merged via the queue into dsldevkit:master with commit 82072be Nov 12, 2026
4 checks passed
@rubenporras
rubenporras deleted the perf/resource-only-cache-adapter branch November 12, 2026 20:55
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