From 1165545bdd3ea47e90336911883312b9bf26757c Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 26 Aug 2026 20:06:25 +0200 Subject: [PATCH] Skip filter evaluation for projects without resource filters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resource.filterChildren runs for every directory scanned by a refresh or an isSynchronized walk. Even for a project without any resource filter it allocated two lists and walked the project-relative path up to the root, allocating an IPath and taking a synchronized getFilter call per segment. Return early when the project description holds no filters, which cuts this garbage from the auto-refresh polling path. ProjectDescription.getFilters is now synchronized like the other filter accessors, so the hot path no longer reads the field outside the monitor those accessors use. For every folder below the project root this is still fewer monitor acquisitions than before, because the loop it replaces took one per path segment. Assisted-by: multiple AI agents and layers of automated tooling 🤖 --- .../eclipse/core/internal/resources/ProjectDescription.java | 5 +++-- .../src/org/eclipse/core/internal/resources/Resource.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java index 69c5e408513..5b72b5727ec 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/ProjectDescription.java @@ -430,9 +430,10 @@ public HashMap getLinks() { * Returns the map of filter descriptions (IPath (project relative path) -> * {@literal LinkedList}). Since this method is only used * internally, it never creates a copy. Returns null if the project does not - * have any filtered resources. + * have any filtered resources. Only the read of the reference is guarded, + * the returned map itself is not. */ - public HashMap> getFilters() { + synchronized public HashMap> getFilters() { return filterDescriptions; } diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java index 1794caf1def..94bfe274d0c 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java @@ -2086,7 +2086,7 @@ public IFileInfo[] filterChildren(IFileInfo[] list, boolean throwException) thro return list; } final ProjectDescription description = project.internalGetDescription(); - if (description == null) { + if (description == null || description.getFilters() == null) { return list; } return filterChildren(project, description, list, throwException);