Conversation
…parser.go Replace `current += string(char)` and `current += ...` accumulations with `strings.Builder` in both `BreakLongExpression` and `BreakAtParentheses`. - BreakLongExpression: single `var current strings.Builder`; also eliminates the inner `sb strings.Builder` that was used for quoted strings (now writes directly into `current`) - BreakAtParentheses: same pattern; use `current.Len()` instead of `len(current)` for the length check Fixes the O(n²) allocation pattern identified in the audit." Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b3b6cf6b-6f89-413d-9e51-ebabb6483911
… variable Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b3b6cf6b-6f89-413d-9e51-ebabb6483911
|
Hey However, the PR is currently empty (zero file changes — only an "Initial plan" commit), and the implementation + test tasks in the checklist are still unchecked. Per the contribution guidelines, an agent-created PR needs to:
When you're ready to continue, here's a prompt to get it done: Note 🔒 Integrity filtering filtered 1 itemIntegrity filtering activated and filtered the following item during workflow execution.
|
There was a problem hiding this comment.
Pull request overview
Improves performance of long-expression line breaking by eliminating quadratic string concatenation in favor of strings.Builder, targeting cases where expressions exceed configured length thresholds.
Changes:
- Replaced per-character
current += ...accumulation withstrings.BuilderinBreakLongExpression. - Applied the same
strings.Builderapproach toBreakAtParentheses, switching length checks tocurrent.Len(). - Reduced repeated
TrimSpace(current.String())calls at flush points via a localtrimmedvariable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
BreakLongExpressionandBreakAtParenthesesaccumulated characters viacurrent += string(char)inside byte-by-byte loops, causing O(n²) allocations — hitting hardest on the long expressions these functions are specifically gated to handle.Changes
BreakLongExpression: Replacecurrent stringaccumulator withvar current strings.Builder; eliminate the innersb strings.Builderused for quoted strings by writing directly intocurrentBreakAtParentheses: Samestrings.Builderreplacement; usecurrent.Len()instead oflen(current)for the length checktrimmed := strings.TrimSpace(current.String())local variable to avoid redundant.String()+TrimSpacedouble-calls at flush pointsBefore:
After:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.