You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Two targeted performance / code-quality improvements with zero behaviour change:
1. Cache JsonSerializerOptions (AppSettings.cs)
JsonSerializerOptions is an expensive object — its constructor builds internal converter and cache tables. Previously AppSettings.Load() and AppSettings.Save() each created a fresh instance on every call. This change promotes them to static readonly fields (ReadOptions / WriteOptions) so they are created once at class load time and reused on every subsequent call.
SetColorTemperature and UpdateAdditionalMonitorWindows each defined identical local helper functions (Lerp, LerpByte) and duplicated the CoolColor / WarmColor constant values. This change:
Extracts them to private static class-level members (CoolColor, WarmColor, LerpColor).
Both call sites are simplified to a one-liner.
The cool / warm local variables on the hot path (mouse-move repaint) are eliminated, reducing GC pressure slightly.
Files Changed
File
Change
AppSettings.cs
ReadOptions / WriteOptions promoted to static readonly
MainWindow.xaml.cs
CoolColor, WarmColor, LerpColor extracted to class-level statics
Test Status
Build tested against net10.0-windows (cross-compiled with EnableWindowsTargeting) — 0 errors, 0 warnings. No existing tests were broken; no new tests were needed (no logic change).
gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/perf-json-cache-2026-06-13-754e9d941e0d2a08.
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (140 of 140 lines)
From 581e6188c50418e0ba65253dfd4c4c287812dff8 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]"
<41898282+github-actions[bot]@users.noreply.github.com>
Date: Wed, 10 Jun 2026 01:39:01 +0000
Subject: [PATCH] Cache JsonSerializerOptions and extract color Lerp helper
JsonSerializerOptions are expensive to construct (they hold internal
converter caches). Previously AppSettings.Load() and AppSettings.Save()
each created a fresh instance on every call. Promoting them to static
readonly fields means the objects are built once and reused.
The Lerp colour helper and the CoolColor/WarmColor constants were
duplicated in two methods (SetColorTemperature and
UpdateAdditionalMonitorWindows). Extract them to static members so
the values are defined in exactly one place, reducing maintenance
risk and eliminating the repeated local-function definitions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
WindowsEdgeLight/AppSettings.cs | 23 +++++++++--------
WindowsEdgeLight/MainWindow.xaml.cs | 40 ++++++++++-------------------
2 files changed, 26 insertions(+), 37 deletions(-)
diff --git a/WindowsEdgeLight/AppSettings.cs b/WindowsEdgeLight/AppSettings.cs
index bf12831..3c9a582 100644
--- a/WindowsEdgeLight/AppSettings.cs+++ b/WindowsEdgeLight/AppSettings.cs@@ -20,6 +20,17 @@ public class AppSettings
/// </summary>
public bool ExcludeFromCapture { get; set; } = true;
+ private static readonly JsonSerializerOptions ReadOptions = new JsonSerializerOptions+ {+ AllowTrailingCommas = true,+ ReadCommentHandling = JsonCommentHandling.Skip+ };++ private static readonly JsonSerializerOptions WriteOptions = new JsonSerializerOptions+ {+ WriteIndented = true+ };+
/// <summary>
/// Load settings from disk
/// </summary>
@@ -30,12 +41,7 @@ public class AppSettings
if (File.Exists(SettingsFilePath))
{
var json = File.ReadAllText(SettingsFileP
... (truncated)
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Two targeted performance / code-quality improvements with zero behaviour change:
1. Cache
JsonSerializerOptions(AppSettings.cs)JsonSerializerOptionsis an expensive object — its constructor builds internal converter and cache tables. PreviouslyAppSettings.Load()andAppSettings.Save()each created a fresh instance on every call. This change promotes them tostatic readonlyfields (ReadOptions/WriteOptions) so they are created once at class load time and reused on every subsequent call.2. Deduplicate colour Lerp helper (MainWindow.xaml.cs)
SetColorTemperatureandUpdateAdditionalMonitorWindowseach defined identical local helper functions (Lerp,LerpByte) and duplicated theCoolColor/WarmColorconstant values. This change:private staticclass-level members (CoolColor,WarmColor,LerpColor).cool/warmlocal variables on the hot path (mouse-move repaint) are eliminated, reducing GC pressure slightly.Files Changed
AppSettings.csReadOptions/WriteOptionspromoted tostatic readonlyMainWindow.xaml.csCoolColor,WarmColor,LerpColorextracted to class-level staticsTest Status
Build tested against
net10.0-windows(cross-compiled withEnableWindowsTargeting) — 0 errors, 0 warnings. No existing tests were broken; no new tests were needed (no logic change).Notes
Note
🔒 Integrity filter blocked 2 items
The following items were blocked because they don't meet the GitHub integrity level.
list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter:Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
repo-assist/perf-json-cache-2026-06-13-754e9d941e0d2a08.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (140 of 140 lines)