Skip to content

Conversation

@wyrapeseed
Copy link
Contributor

@wyrapeseed wyrapeseed commented Oct 22, 2025

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.

category: refactor
ticket: none

Signed-off-by: wyrapeseed <wyrapeseed@outlook.com>
@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@codecov
Copy link

codecov bot commented Oct 22, 2025

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 53.74%. Comparing base (938ab64) to head (d9e1519).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
app/eth2wrap/genwrap/genwrap.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4043      +/-   ##
==========================================
- Coverage   53.79%   53.74%   -0.06%     
==========================================
  Files         242      242              
  Lines       39412    39412              
==========================================
- Hits        21203    21183      -20     
- Misses      15967    15989      +22     
+ Partials     2242     2240       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pinebit pinebit requested a review from Copilot October 22, 2025 15:05
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 replaces strings.Split with strings.SplitSeq in loop iterations to improve memory efficiency. The SplitSeq function, introduced in Go 1.23, returns a lazy sequence that allows iterating over tokens without creating an intermediate slice, reducing memory allocations.

Key Changes

  • Replaced strings.Split with strings.SplitSeq in four files where the result was immediately iterated over
  • Updated loop syntax from for _, item := range strings.Split(...) to for item := range strings.SplitSeq(...)

Reviewed Changes

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

File Description
core/validatorapi/router.go Updated query parameter parsing to use SplitSeq for comma-separated values
cmd/markdown_internal_test.go Updated test file line iteration to use SplitSeq
app/log/config.go Updated stack trace formatting to use SplitSeq for newline splitting
app/eth2wrap/genwrap/genwrap.go Updated documentation parsing to use SplitSeq for newline splitting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pinebit
Copy link
Collaborator

pinebit commented Oct 22, 2025

Thank you @wyrapeseed for the contribution!

@pinebit pinebit requested a review from KaloyanTanev October 22, 2025 15:06
@wyrapeseed
Copy link
Contributor Author

Thanks for your review.

If there's anything need I to do, please feel free to let me know.

@KaloyanTanev KaloyanTanev added the merge when ready Indicates bulldozer bot may merge when all checks pass label Oct 23, 2025
@obol-bulldozer obol-bulldozer bot merged commit ebc262e into ObolNetwork:main Oct 23, 2025
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge when ready Indicates bulldozer bot may merge when all checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants