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 string quote performance #1132

Merged
merged 1 commit into from
Jun 16, 2022

Conversation

justinmeiners
Copy link

The quote function was showing up in my instruments profile. The current implementation requires an allocation of a one or more strings at every step of the reduce. This version adds one character at a time and relies on the geometric growth of the string itself. I personally think it's a little clearer as well.

I considered adding reserveCapacity to the beginning, but that might be a bit of a micro-optimization.

@jberkel jberkel merged commit 578be41 into stephencelis:master Jun 16, 2022
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