Skip to content

Conversation

@promalert
Copy link

strings.Builder has fewer memory allocations and better performance.
More info: golang/go#75190

@junegunn junegunn requested a review from Copilot November 5, 2025 12:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes string concatenation operations by replacing inefficient += concatenation with strings.Builder, which is more memory-efficient and performs better for multiple string concatenations.

  • Replaces string concatenation using += operator with strings.Builder methods
  • Updates multiple functions across the codebase to use the builder pattern
  • Maintains the same functionality while improving performance

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/util/util.go Updates RepeatToFill and ToKebabCase functions to use strings.Builder
src/tmux.go Refactors runTmux to build command arguments string with strings.Builder
src/terminal.go Converts extractPassThroughs and parsePlaceholder to use strings.Builder
src/options.go Updates nthTransformer closure to use strings.Builder for building result strings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@promalert
Copy link
Author

@junegunn Hi, Could you please review this PR at your convenience? Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant