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

Add IO overloads to Char#upcase, #downcase, #titlecase #15508

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HertzDevil
Copy link
Contributor

These additions mirror String#upcase, #downcase, and #capitalize respectively, which also have overloads that accept an IO.

There is a more technical reason for this PR. Case conversion methods in String are among the largest functions in the standard library when measured by the number of lines of LLVM IR; #underscore measures 4.2k lines, #camelcase 1.9k lines, and #titleize 1.4k lines. This is due to inlining of the multiple { |c| io << c } blocks, which go all the way down to the body of e.g. Unicode.downcase(char : Char, options : CaseOptions, &). By establishing an inlining boundary, those line counts are now 0.67k, 0.23k, and 0.25k, whereas the new Char methods themselves contribute another 0.75k lines total.

@straight-shoota straight-shoota added this to the 1.16.0 milestone Feb 23, 2025
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