Skip to content

Search View: Performance issues on remove and sort#3733

Merged
iloveeclipse merged 1 commit intoeclipse-platform:masterfrom
mehmet-karaman:batch_remove_search_matches
Mar 9, 2026
Merged

Search View: Performance issues on remove and sort#3733
iloveeclipse merged 1 commit intoeclipse-platform:masterfrom
mehmet-karaman:batch_remove_search_matches

Conversation

@mehmet-karaman
Copy link
Contributor

@mehmet-karaman mehmet-karaman commented Feb 17, 2026

  • Implemented a batch removal of search matches
  • Search matches are removed from their parent, instead of one by one
    which causes performance issues
  • It's also fixing the problem, that all elements are removed instead
    only the visible elements (while all others are filtered by the limit
    number)
  • Replaces the
    ConcurrentHashMap.newKeySet() with the ConcurrentSkipListSet with the
    comparator and makes the additional sorting obsolete.

Fixes #3735

@iloveeclipse
Copy link
Member

@mehmet-karaman : please first create a ticket and explain the problem.
Note: you seem to use wrong git author mail, please use same which you've used in ECA process.

@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch from 2a62c61 to 73cab0d Compare February 17, 2026 14:52
@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

Test Results

   852 files  ± 0     852 suites  ±0   57m 50s ⏱️ + 1m 2s
 7 848 tests + 4   7 605 ✅ + 5  243 💤 ±0  0 ❌  - 1 
20 070 runs  +12  19 414 ✅ +13  656 💤 ±0  0 ❌  - 1 

Results for commit 526db36. ± Comparison against base commit b819cf9.

♻️ This comment has been updated with latest results.

@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch 4 times, most recently from dff7693 to 300ca6b Compare February 17, 2026 23:07
@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch from 300ca6b to fe5e861 Compare February 18, 2026 22:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses Search View performance and correctness when removing matches, by enabling batch removal at the “enclosing element” (e.g., file/resource) level and ensuring removals aren’t limited to only currently visible (element-limited) results.

Changes:

  • Updated AbstractTextSearchViewPage.internalRemoveSelected() to batch-remove matches by selected IFile / IContainer resources before falling back to per-match removal for non-resource selections.
  • Added AbstractTextSearchResult.removeElements(...) to remove all matches for selected elements via a single map-entry removal per element.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
bundles/org.eclipse.search/newsearch/org/eclipse/search/ui/text/AbstractTextSearchViewPage.java Adds resource-aware pre-processing in “Remove Selected Matches” to remove matches by file/container in a batch.
bundles/org.eclipse.search/newsearch/org/eclipse/search/ui/text/AbstractTextSearchResult.java Introduces an element-based batch removal method to efficiently drop all matches for selected elements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch 2 times, most recently from 4cd364f to b53503b Compare February 19, 2026 11:20
@mehmet-karaman mehmet-karaman changed the title Search View: Batch removing of search matches Search View: Performance issues on remove and sort Feb 19, 2026
@iloveeclipse iloveeclipse requested a review from Copilot February 19, 2026 11:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch 2 times, most recently from 17ec4af to fc2f401 Compare February 19, 2026 12:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@iloveeclipse iloveeclipse force-pushed the batch_remove_search_matches branch from 40ee202 to 7d37158 Compare February 19, 2026 15:13
@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch from 7d37158 to d572e09 Compare February 20, 2026 11:22
@merks
Copy link
Contributor

merks commented Mar 2, 2026

We're seeing many problems in many builds, including this one.

https://ci.eclipse.org/platform/job/eclipse.platform.releng.aggregator/job/PR-3680/12/console

@iloveeclipse
Copy link
Member

@merks : I've also heard about failing egit nightly builds due slow execution. Looks like something issue affects many different projects.

@merks
Copy link
Contributor

merks commented Mar 2, 2026

I asked @fredg02 about known problems, but the team is not aware of any general problem, though they are keeping their eyes out.

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

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

I have few comments on tests, beside this looks OK

@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch from a15430b to 7adb6b1 Compare March 2, 2026 15:43
@iloveeclipse
Copy link
Member

@mehmet-karaman : please if you push, resolve all things that are resolved.

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

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

I will push extra commit with test fixes and a TODO that must be implemented

@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch from 48dd9b0 to 2950265 Compare March 2, 2026 22:41
@mehmet-karaman
Copy link
Contributor Author

Failed test on Linux: org.eclipse.jface.text.tests.reconciler.AbstractReconcilerTest.testReplacingDocumentWhenClean()

Locally it worked on windows.

Searched in github issues and found: #2708

@mehmet-karaman
Copy link
Contributor Author

@iloveeclips I've replaced the job join thing with a refresh of the viewer, which triggers the content provider.

@iloveeclipse
Copy link
Member

The test shows exact the (sporadic) fail I've seen before:
https://github.com/eclipse-platform/eclipse.platform.ui/runs/65745891432

Should have only one direct element ==> expected: <1> but was: <0>
org.opentest4j.AssertionFailedError: Should have only one direct element ==> expected: <1> but was: <0>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:563)
	at org.eclipse.search.tests.TextSearchResultTest.testBatchRemoveElementsByProject(TextSearchResultTest.java:137)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

@mehmet-karaman
Copy link
Contributor Author

mehmet-karaman commented Mar 4, 2026

Started a new trial.. Added this on line 81 to see when we have the results in the view

		while (true) {
			Object[] directElements= getDirectElements();

			if (directElements.length > 0) {
				break;
			}
			System.out.println("Empty");
		}

This snipped helped to get catched in an endless loop and try different things out until the directElements gets entries.

The following snippet after the system.out.println("Empty") helped to get out of the endless loop:

AbstractTextSearchResult searchResult= (AbstractTextSearchResult) fQuery1.getSearchResult();
getSearchPage().getViewer().setInput(searchResult);

This solves our test problem, but I still don't have an answer why refresh() didn't helped and setInput() had to be called.. At that point the Input was equal equal to the searchResult object.

@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch 4 times, most recently from 0c003e9 to 6e502c9 Compare March 6, 2026 10:48
@iloveeclipse iloveeclipse requested a review from Copilot March 6, 2026 17:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch 2 times, most recently from 55c96a0 to d982bda Compare March 8, 2026 20:08


- Implemented a batch removal of search matches
- Search matches are removed from their parent, instead of one by one
which causes performance issues
- It's also fixing the problem, that all elements are removed instead
only the visible elements (while all others are filtered by the limit
number)
- Replaces the
ConcurrentHashMap.newKeySet() with the ConcurrentSkipListSet with the
comparator and makes the additional sorting obsolete.
- After this change, avoid using `size()` on values, because it is not
more constant time operation, see `ConcurrentSkipListSet` javadoc.
- Also comparator must be changed to consider different Match elements
with same size and offsets in the set - otherwise the
`ConcurrentSkipListSet` would lost them.
- Added `AbstractTextSearchResult.hasMatches(Object element)` API for
cases where match count not needed.
- If possible, calls to `size()` changed to `isEmpty()` or omitted.
- Implemented Tests

Fixes eclipse-platform#3735

Co-authored-by: Andrey Loskutov <loskutov@gmx.de>
@mehmet-karaman mehmet-karaman force-pushed the batch_remove_search_matches branch from d982bda to 526db36 Compare March 9, 2026 08:14
@iloveeclipse iloveeclipse merged commit 300659d into eclipse-platform:master Mar 9, 2026
18 checks passed
@iloveeclipse
Copy link
Member

Thanks Mehmet.

@mehmet-karaman mehmet-karaman deleted the batch_remove_search_matches branch March 9, 2026 12:52
@mehmet-karaman
Copy link
Contributor Author

Thank you too.

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.

Search view with millions of matches is freezing the UI

5 participants