perf: pre-compute column indices once per table; avoid Vec<char> in detect_columns#61
Merged
shanselman merged 3 commits intomainfrom Mar 28, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/shanselman/winget-tui/sessions/bb4308cc-b674-4932-a4c7-aa8a850bbd1d Co-authored-by: shanselman <2892+shanselman@users.noreply.github.com>
…etect_columns Agent-Logs-Url: https://github.com/shanselman/winget-tui/sessions/bb4308cc-b674-4932-a4c7-aa8a850bbd1d Co-authored-by: shanselman <2892+shanselman@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve performance by pre-computing column indices in output parser
perf: pre-compute column indices once per table; avoid Vec<char> in detect_columns
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two hot-path allocations in the winget output parser eliminated — one per-row (repeated
to_lowercasecolumn lookups), one per-table (collecting header chars into aVec<char>).Changes
detect_columns: replacedVec<char>collect + index loop withchar_indices().peekable(), giving(byte_offset, char)pairs directly with no heap allocation.PackageCols/SourceColsstructs (#[derive(Copy, Clone)]): hold pre-computedOption<usize>column indices. Factory methodspackage_column_map()/source_column_map()run allfind_column_cicalls and positional-fallback logic once per table instead of once per row.No behaviour change — purely mechanical refactor of the parsing hot path.
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.