Skip to content

Avoid calling chars.size on Strings#15822

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
HertzDevil:refactor/string-chars-size
May 26, 2025
Merged

Avoid calling chars.size on Strings#15822
straight-shoota merged 1 commit intocrystal-lang:masterfrom
HertzDevil:refactor/string-chars-size

Conversation

@HertzDevil
Copy link
Contributor

These are all equivalent to calling just #size directly, and there is no need to create an intermediate Array.

For the record, they also do not benefit from using the much newer #grapheme_size.

@straight-shoota straight-shoota added this to the 1.17.0 milestone May 23, 2025
@straight-shoota straight-shoota merged commit c16d805 into crystal-lang:master May 26, 2025
38 checks passed
@HertzDevil HertzDevil deleted the refactor/string-chars-size branch May 26, 2025 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants