Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve splitLines: return iterator instead #434

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

Goose97
Copy link
Contributor

@Goose97 Goose97 commented Jun 28, 2023

The current behavior of splitLines is to eagerly split all the lines and return an array of strings.

This PR improves this by returning an iterator instead, which will emit lines. This lets callers decide how to best use the splitLines function (i.e. lazily enumerate over lines)

Relates to #433

The current behavior of splitLines is to eagerly split all the lines and return an array of strings.

This PR improves this by returning an iterator instead, which will emit lines. This lets callers decide how to best use the splitLines function (i.e. lazily enumerate over lines)

Relates to jlfwong#433
@coveralls
Copy link

Coverage Status

coverage: 43.012%. first build when pulling 6f26e2e on Goose97:split-lines-iterator into bb063e4 on jlfwong:main.

@jlfwong jlfwong merged commit 26884c1 into jlfwong:main Jun 28, 2023
@jlfwong
Copy link
Owner

jlfwong commented Jun 28, 2023

Nice! Thank you

jackerghan pushed a commit to jackerghan/speedscope that referenced this pull request Jul 28, 2023
The current behavior of splitLines is to eagerly split all the lines and return an array of strings.

This PR improves this by returning an iterator instead, which will emit lines. This lets callers decide how to best use the splitLines function (i.e. lazily enumerate over lines)

Relates to jlfwong#433
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.

3 participants