Refactor KeyRegularizer to reduce allocations#1120
Merged
Conversation
8221b99 to
8f2bf0d
Compare
Owner
|
@byroot Can you please rebase this and resolve the conflicts? Thanks. |
8f2bf0d to
eb086a6
Compare
Contributor
Author
|
Rebased. |
Contributor
Author
|
Hum, might need some more changes. Looking. |
Interfaces that return multi values aren't great in hotspot as they require to allocate a very short lived array and the Ruby VM isn't yet sophisticated enough to elude it. But since in the happy path we only need to check if the key need to be encoded, we can decompose that single method into two calls, and save more performance on the happy path (one allocation) than we lose on the slow path (one method call). Also refactor `multi_get / multi_set / multi_delete` to be generated by `RequestFormatter` so that they can use its internal helpers to encode keys.
eb086a6 to
d18e942
Compare
Owner
|
Thanks @byroot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Interfaces that return multi values aren't great in hotspot as they require to allocate a very short lived array and the Ruby VM isn't yet sophisticated enough to elude it.
But since in the happy path we only need to check if the key need to be encoded, we can decompose that single method into two calls, and save more performance on the happy path (one allocation) than we lose on the slow path (one method call).
Also refactor
multi_get / multi_set / multi_deleteto be generated byRequestFormatterso that they can use its internal helpers to encode keys.