Skip to content

Performance optimizations across core components#794

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/review-project-performance
Draft

Performance optimizations across core components#794
Copilot wants to merge 3 commits intomainfrom
copilot/review-project-performance

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Description of Change

Targeted performance fixes for five hotspots found during a codebase performance review.

  • Touch.cs RemoveEffects — O(n²) while/FirstOrDefault/Remove loop → single-pass reverse for with RemoveAt(i)
  • SearchBar.csCancellationTokenSource leaked on every keystroke; now disposed before replacement
  • ListItem.cs OnVerticalStackLayoutSizeChanged.Where().ToList().IndexOf() allocated a list on every SizeChanged event; replaced with zero-allocation foreach that breaks on first visible item
  • DUI.cs EnsureSkLottieResourcesAdded — LINQ .All() scan on every call; cached with static bool after first registration
  • Shell.cs debug diagnostics — two .Where().ToList() passes over the same collection; combined into single-pass partition loop
// Before: O(n²) — repeated linear scans
while (view.Effects.Any(e => e is Touch))
    view.Effects.Remove(view.Effects.FirstOrDefault(e => e is Touch));

// After: O(n) — single reverse pass
for (var i = view.Effects.Count - 1; i >= 0; i--)
    if (view.Effects[i] is Touch)
        view.Effects.RemoveAt(i);

Todos

  • I have tested on an Android device.
  • I have tested on an iOS device.
  • I have supported accessibility

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 27, 2026 13:05
…istItem divider logic, SKLottie caching, Shell enumeration

Co-authored-by: Vetle444 <35739538+Vetle444@users.noreply.github.com>
Co-authored-by: Vetle444 <35739538+Vetle444@users.noreply.github.com>
Copilot AI changed the title [WIP] Assess project performance and component optimization Performance optimizations across core components Feb 27, 2026
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.

2 participants