From ac5a72cf582ac0d90bcdde28cb91017fec1ac62f Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:29:59 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[performance=20improvem?= =?UTF-8?q?ent]=20optimize=20string=20splitting=20in=20PathExecutableLooku?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced string.Split with ReadOnlySpan.Split to avoid array and intermediate string allocations in the hot path. --- QuickShell.Core/Services/PathExecutableLookup.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/QuickShell.Core/Services/PathExecutableLookup.cs b/QuickShell.Core/Services/PathExecutableLookup.cs index be5d483e..22c81cdc 100644 --- a/QuickShell.Core/Services/PathExecutableLookup.cs +++ b/QuickShell.Core/Services/PathExecutableLookup.cs @@ -115,11 +115,18 @@ public static bool TryFindOnPath(string fileName, out string fullPath) } var name = Path.GetFileName(fileName.Trim()); - foreach (var segment in pathValue.Split(';', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)) + // ⚡ Bolt: Performance optimization - use AsSpan().Split() to avoid allocating intermediate string array and instances + foreach (var range in pathValue.AsSpan().Split(';')) { + var segment = pathValue.AsSpan()[range].Trim(); + if (segment.IsEmpty) + { + continue; + } + try { - var candidate = Path.Join(segment, name); + var candidate = Path.Join(segment, name.AsSpan()); if (!File.Exists(candidate)) { continue; From 543af56f9615e9bfb67f814e679662f527e2c755 Mon Sep 17 00:00:00 2001 From: Anthony Thompson Date: Sat, 25 Jul 2026 00:45:09 -0700 Subject: [PATCH 2/4] Potential fix for pull request finding 'CodeQL / Useless assignment to local variable' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Anthony Thompson --- QuickShell.Core/Services/PathExecutableLookup.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/QuickShell.Core/Services/PathExecutableLookup.cs b/QuickShell.Core/Services/PathExecutableLookup.cs index 22c81cdc..3f9c46a1 100644 --- a/QuickShell.Core/Services/PathExecutableLookup.cs +++ b/QuickShell.Core/Services/PathExecutableLookup.cs @@ -115,10 +115,9 @@ public static bool TryFindOnPath(string fileName, out string fullPath) } var name = Path.GetFileName(fileName.Trim()); - // ⚡ Bolt: Performance optimization - use AsSpan().Split() to avoid allocating intermediate string array and instances - foreach (var range in pathValue.AsSpan().Split(';')) + foreach (var rawSegment in pathValue.Split(';')) { - var segment = pathValue.AsSpan()[range].Trim(); + var segment = rawSegment.AsSpan().Trim(); if (segment.IsEmpty) { continue; From 86869b15a66ffaa4b3e0e437481e0be4576d90b3 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:48:59 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`bol?= =?UTF-8?q?t-optimize-pathexecutablelookup-2058457576382213745`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @tonythethompson. The following files were modified: * `QuickShell.Core/Services/PathExecutableLookup.cs` --- QuickShell.Core/Services/PathExecutableLookup.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/QuickShell.Core/Services/PathExecutableLookup.cs b/QuickShell.Core/Services/PathExecutableLookup.cs index 3f9c46a1..e4fbd886 100644 --- a/QuickShell.Core/Services/PathExecutableLookup.cs +++ b/QuickShell.Core/Services/PathExecutableLookup.cs @@ -100,6 +100,12 @@ private static IEnumerable EnumerateKnownLocationCandidates(string syste } } + /// + /// Searches the PATH environment variable for an existing executable. + /// + /// The executable file name to locate. + /// Receives the fully qualified path when the executable is found. + /// true if an existing executable is found; false otherwise. public static bool TryFindOnPath(string fileName, out string fullPath) { fullPath = string.Empty; From 07a57b2a1602f7e61b9a161922de0f256c59e2a9 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:49:11 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[performance=20improvem?= =?UTF-8?q?ent]=20optimize=20string=20splitting=20in=20PathExecutableLooku?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced string.Split with ReadOnlySpan.Split to avoid array and intermediate string allocations in the hot path. --- QuickShell.Core/Services/PathExecutableLookup.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/QuickShell.Core/Services/PathExecutableLookup.cs b/QuickShell.Core/Services/PathExecutableLookup.cs index e4fbd886..22c81cdc 100644 --- a/QuickShell.Core/Services/PathExecutableLookup.cs +++ b/QuickShell.Core/Services/PathExecutableLookup.cs @@ -100,12 +100,6 @@ private static IEnumerable EnumerateKnownLocationCandidates(string syste } } - /// - /// Searches the PATH environment variable for an existing executable. - /// - /// The executable file name to locate. - /// Receives the fully qualified path when the executable is found. - /// true if an existing executable is found; false otherwise. public static bool TryFindOnPath(string fileName, out string fullPath) { fullPath = string.Empty; @@ -121,9 +115,10 @@ public static bool TryFindOnPath(string fileName, out string fullPath) } var name = Path.GetFileName(fileName.Trim()); - foreach (var rawSegment in pathValue.Split(';')) + // ⚡ Bolt: Performance optimization - use AsSpan().Split() to avoid allocating intermediate string array and instances + foreach (var range in pathValue.AsSpan().Split(';')) { - var segment = rawSegment.AsSpan().Trim(); + var segment = pathValue.AsSpan()[range].Trim(); if (segment.IsEmpty) { continue;