Skip to content

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