[GTK] Fetch List items once in setSelection(String[]) - #3657
Merged
Merged
Conversation
Contributor
akurtakov
force-pushed
the
gtk-list-indexof
branch
from
October 1, 2026 11:23
3295518 to
fd12ef5
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The corrected negative-start behavior needs regression coverage.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Optimizes GTK List selection and corrects negative-start lookup behavior.
Changes:
- Reuses one item snapshot during string-array selection.
- Returns
-1for negativeindexOfstarts.
| File | Description |
|---|---|
List.java |
Optimizes lookups and validates starting indices. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
setSelection(String[]) called indexOf per string, and each indexOf copied all items natively; it now fetches them once. indexOf also returns -1 for an out-of-range start as documented instead of throwing. Assisted-by: multiple AI agents and layers of automated tooling 🤖
vogella
force-pushed
the
gtk-list-indexof
branch
from
October 2, 2026 04:26
fd12ef5 to
9e0a71b
Compare
Contributor
Author
|
Fixed |
Contributor
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.

List.setSelection(String[]) called indexOf for every string, and each indexOf copied all items from the native model, which made it O(m*n) native string fetches. It now fetches the items once; selecting 100 strings in a list of 50,000 items drops from about 3 s to 33 ms, and in a list of 10,000 items from about 590 ms to 7 ms. indexOf(String, int) also returns -1 for a negative start as its Javadoc specifies, instead of throwing ArrayIndexOutOfBoundsException.