Skip to content

refactor: replace Split in loops with more efficient SplitSeq#2667

Merged
ucwong merged 1 commit intoCortexFoundation:masterfrom
eroderust:master
Mar 4, 2026
Merged

refactor: replace Split in loops with more efficient SplitSeq#2667
ucwong merged 1 commit intoCortexFoundation:masterfrom
eroderust:master

Conversation

@eroderust
Copy link
Contributor

strings.SplitSeq (introduced in Go 1.23) returns a lazy sequence (strings.Seq), allowing gopher to iterate over tokens one by one without creating an intermediate slice.

It significantly reduces memory allocations and can improve performance for long strings.

More info: golang/go#61901

Signed-off-by: eroderust <eroderust@outlook.com>
@ucwong ucwong merged commit a429963 into CortexFoundation:master Mar 4, 2026
1 check failed
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.

2 participants