Skip to content

perf: optimize resource allocation and improve thread safety#195

Open
Y-ASLant wants to merge 1 commit into
IgorMundstein:mainfrom
Y-ASLant:main
Open

perf: optimize resource allocation and improve thread safety#195
Y-ASLant wants to merge 1 commit into
IgorMundstein:mainfrom
Y-ASLant:main

Conversation

@Y-ASLant

@Y-ASLant Y-ASLant commented Jun 11, 2026

Copy link
Copy Markdown
  • Cache Languages list in Localizer to avoid repeated initialization
  • Replace GCHandle.Alloc with Marshal.AllocHGlobal in ComputerService to reduce GC pressure and heap fragmentation
  • Cache Font and StringFormat in NotificationService for icon rendering
  • Cache Brushes collection in MainViewModel and fix process disposal leak
  • Replace BitArray with Brian Kernighan bit counting algorithm
  • Add Interlocked guard for concurrent optimization in WinService
  • Fix lock granularity in MainViewModel.Optimize for better throughput
  • Simplify ServiceController usage in WinService
  • Remove redundant Settings.Save() call in Settings finalizer

Closes #168
Closes #181
Closes #183
Closes #190
Closes #192

Summary

Please provide a brief description of the changes made in this pull request.

Related Issue

If applicable, link to the issue this PR addresses: Fixes #<issue_number>

Changes

  • What did you change?
  • Why is this change needed?

Checklist

  • My code follows the project’s coding style and conventions.
  • I have tested the changes locally.
  • I have updated documentation if necessary.
  • This PR does not introduce any breaking changes.
  • I have added unit tests if applicable.

Additional Notes

Include any additional information or context for reviewers.

- Cache Languages list in Localizer to avoid repeated initialization
- Replace GCHandle.Alloc with Marshal.AllocHGlobal in ComputerService
  to reduce GC pressure and heap fragmentation
- Cache Font and StringFormat in NotificationService for icon rendering
- Cache Brushes collection in MainViewModel and fix process disposal leak
- Replace BitArray with Brian Kernighan bit counting algorithm
- Add Interlocked guard for concurrent optimization in WinService
- Fix lock granularity in MainViewModel.Optimize for better throughput
- Simplify ServiceController usage in WinService
- Remove redundant Settings.Save() call in Settings finalizer

Closes IgorMundstein#168
Closes IgorMundstein#181
Closes IgorMundstein#183
Closes IgorMundstein#190
Closes IgorMundstein#192
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment