Compare the matcher context once per content type lookup - #2930
Merged
vogella merged 1 commit intoSep 21, 2026
Merged
Conversation
Contributor
ContentTypeCatalog compared the matcher's scope context against the default context for every content type it visited. For a project matcher that comparison resolves the project's content type preferences, which walks preference nodes and the workspace tree, so a single file lookup did hundreds of tree lookups and froze the UI when opening editors. The comparison now happens once in internalFindContentTypesSorted and its result is passed down to ContentType.hasFileSpec. With ContentDescriptionPerformanceTest and its 300 extra xml content types, 1000 project matcher look-ups drop from about 60 ms to 35 ms and the cold description pass over 5000 files from about 1 s to 0.65 s. Assisted-by: multiple AI agents and layers of automated tooling 🤖
vogella
force-pushed
the
content-type-context-compare-once
branch
from
September 15, 2026 04:25
4cc2c6c to
abe5985
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The focused optimization preserves existing matching behavior and introduces no unresolved issues.
Pull request overview
Optimizes project-scoped content-type lookup by reusing the default-context comparison.
Changes:
- Compute context equality once per lookup.
- Pass the result through name and extension matching.
File summaries
| File | Description |
|---|---|
ContentTypeCatalog.java |
Reuses the context comparison throughout lookup. |
ContentType.java |
Adds an internal overload accepting the cached result. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening an editor on a file in a project froze the UI in content type lookup. ContentTypeCatalog compared the matcher's scope context against the default context for every content type it visited, and for a project matcher that comparison resolves the project's content type preferences, which walks preference nodes and does a workspace tree lookup. With hundreds of installed content types one file lookup did hundreds of tree lookups, and it repeated for every content type query on a project resource.
The comparison now happens once per lookup in internalFindContentTypesSorted and its result is passed down to ContentType.hasFileSpec, so behaviour is unchanged for projects with and without project specific content type settings. Measured with the migrated ContentDescriptionPerformanceTest from #2929 and its 300 extra xml content types, 1000 project matcher look-ups drop from about 60 ms to 35 ms and the cold description pass over 5000 files from about 1 s to 0.65 s. The content type tests in org.eclipse.core.tests.resources pass with the bundle in the reactor.