Skip to content

Conversation

@VictoriousRaptor
Copy link
Contributor

@VictoriousRaptor VictoriousRaptor commented Jan 18, 2026

Performance and virtualization enhancements

  • Changed the VirtualizingStackPanel.VirtualizationMode in ResultListBox.xaml from Standard to Recycling to improve performance and resource usage when rendering large lists.

@github-actions github-actions bot added this to the 2.1.0 milestone Jan 18, 2026
@gitstream-cm
Copy link

gitstream-cm bot commented Jan 18, 2026

🥷 Code experts: jjw24

jjw24, Jack251970 have most 👩‍💻 activity in the files.
jjw24 has most 🧠 knowledge in the files.

See details

Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs

Activity based on git-commit:

jjw24 Jack251970
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
jjw24: 100%

Flow.Launcher/Converters/OrdinalConverter.cs

Activity based on git-commit:

jjw24 Jack251970
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
jjw24: 100%

Flow.Launcher/ResultListBox.xaml

Activity based on git-commit:

jjw24 Jack251970
JAN
DEC
NOV
OCT 1 additions & 0 deletions
SEP
AUG

Knowledge based on git-blame:
jjw24: 100%

Flow.Launcher/ResultListBox.xaml.cs

Activity based on git-commit:

jjw24 Jack251970
JAN
DEC
NOV 25 additions & 22 deletions
OCT
SEP
AUG

Knowledge based on git-blame:
jjw24: 85%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

Copy link
Contributor

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 pull request enables virtualization with recycling mode for the ResultListBox, which improves memory efficiency by reusing ListBoxItem containers instead of creating new ones for each data item. The changes update the selection logic and converters to work correctly with recycled containers by referencing data items instead of container instances.

Changes:

  • Enabled virtualization recycling mode in the ResultListBox XAML
  • Updated selection tracking to use ResultViewModel data items instead of ListBoxItem containers
  • Modified OrdinalConverter and OpenResultHotkeyVisibilityConverter to use data-based indexing instead of container-based indexing

Reviewed changes

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

File Description
Flow.Launcher/ResultListBox.xaml Changed VirtualizationMode from "Standard" to "Recycling" and removed trailing whitespace
Flow.Launcher/ResultListBox.xaml.cs Replaced ListBoxItem container tracking with ResultViewModel data tracking for recycling compatibility
Flow.Launcher/Converters/OrdinalConverter.cs Changed from container-based to data-based index lookup with appropriate null handling
Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs Changed from container-based to data-based index lookup with appropriate null handling

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

@Jack251970 Jack251970 added enhancement New feature or request kind/ui related to UI, icons, themes, etc labels Feb 10, 2026
@Jack251970
Copy link
Member

@cubic-dev-ai review this pull request

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Feb 10, 2026

@cubic-dev-ai review this pull request

@Jack251970 I have started the AI code review. It will take a few minutes to complete.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 4 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="Flow.Launcher/Converters/OrdinalConverter.cs">

<violation number="1" location="Flow.Launcher/Converters/OrdinalConverter.cs:24">
P2: `listBox.Items.IndexOf(dataItem)` performs a linear search (O(N)), which can cause performance degradation when the list is large (e.g., with "Everything" plugin or many results). This negates the performance benefits of using `VirtualizationMode.Recycling`.

Since the hotkey is typically only displayed for the first 10 items (and hidden otherwise by `OpenResultHotkeyVisibilityConverter`), you should optimize this by searching only the first 10 items. This changes the complexity from O(N) to O(1).</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment on lines +24 to 32
var index = listBox.Items.IndexOf(dataItem);
if (index < 0)
{
return 0;
}

var res = index + 1;
return res == 10 ? 0 : res; // 10th item => HOTKEY+0
}
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 10, 2026

Choose a reason for hiding this comment

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

P2: listBox.Items.IndexOf(dataItem) performs a linear search (O(N)), which can cause performance degradation when the list is large (e.g., with "Everything" plugin or many results). This negates the performance benefits of using VirtualizationMode.Recycling.

Since the hotkey is typically only displayed for the first 10 items (and hidden otherwise by OpenResultHotkeyVisibilityConverter), you should optimize this by searching only the first 10 items. This changes the complexity from O(N) to O(1).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Flow.Launcher/Converters/OrdinalConverter.cs, line 24:

<comment>`listBox.Items.IndexOf(dataItem)` performs a linear search (O(N)), which can cause performance degradation when the list is large (e.g., with "Everything" plugin or many results). This negates the performance benefits of using `VirtualizationMode.Recycling`.

Since the hotkey is typically only displayed for the first 10 items (and hidden otherwise by `OpenResultHotkeyVisibilityConverter`), you should optimize this by searching only the first 10 items. This changes the complexity from O(N) to O(1).</comment>

<file context>
@@ -15,9 +15,20 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
+            return 0;
+        }
 
+        var index = listBox.Items.IndexOf(dataItem);
+        if (index < 0)
+        {
</file context>
Suggested change
var index = listBox.Items.IndexOf(dataItem);
if (index < 0)
{
return 0;
}
var res = index + 1;
return res == 10 ? 0 : res; // 10th item => HOTKEY+0
}
var items = listBox.Items;
for (int i = 0; i < items.Count && i < 10; i++)
{
if (Equals(items[i], dataItem))
{
var res = i + 1;
return res == 10 ? 0 : res;
}
}
return 0;
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 min review enhancement New feature or request kind/ui related to UI, icons, themes, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants