perf(console): case-insensitive filtering without per-line copies

Console text filtering and match highlighting lowercased a full copy of
every line, and of every drawn segment, on each pass.

- A new alloc-free ASCII case-insensitive substring search folds both
  sides on the fly, so neither the filter test nor the highlight scan
  allocates a lowercased copy per line any more.
- Both call sites use it; the case-insensitive match behaviour is
  unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 08:23:30 -05:00
co-authored by Claude Opus 4.8
parent 6a24355c79
commit 70e96f75f0
3 changed files with 18 additions and 13 deletions
+4
View File
@@ -18,6 +18,10 @@ struct ConsoleOutputFilter {
bool appMessagesEnabled = true; // App channel
};
// Alloc-free ASCII case-insensitive substring search (C-locale fold). Returns the byte
// offset of the first match at or after `from`, or npos. Needle is folded on the fly.
size_t FindCaseInsensitive(const char* hay, size_t hayLen, const std::string& needle, size_t from);
// Whether a line with the given channel + text passes the active filter.
bool consoleLinePassesFilter(const std::string& lineText,
ConsoleChannel channel,