Skip to content

Comments

Prefer strings.SplitSeq over strings.Split where possible#7051

Open
caxu-rh wants to merge 1 commit intooperator-framework:masterfrom
caxu-rh:strings-splitseq
Open

Prefer strings.SplitSeq over strings.Split where possible#7051
caxu-rh wants to merge 1 commit intooperator-framework:masterfrom
caxu-rh:strings-splitseq

Conversation

@caxu-rh
Copy link

@caxu-rh caxu-rh commented Feb 19, 2026

Description of the change:
Replace usages of strings.Split with strings.SplitSeq in cases where we are iterating through the results; this returns an iterator over the original string, saving a slice allocation and is generally more efficient when rangeing over it. There is no expected user-facing change in behavior.

Motivation for the change:
Some slight performance improvements.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

SplitSeq returns an iterator over the substrings rather than
constructing and returning a slice, which works well in cases where
we are just iterating over the result anyways.

Signed-off-by: Caleb Xu <caxu@redhat.com>
@openshift-ci openshift-ci bot requested review from jberkhahn and oceanc80 February 19, 2026 20:24
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