Repository navigation
perf(runtime): better varint and string serde - #23
Merged
Merged
Conversation
Varints of one or two bytes (values below 2^14) are read and written inline, with one bounds check for both bytes. Longer ones go out of line, through pdep and pext where BMI2 is fast: everywhere but AMD families 15h to 18h. Reads still consume the same bytes and return the same values as upstream's.
ASCII strings, the common case, are written in one narrowing pass, since their byte count is their length, and read by widening, which Latin-1 does for ASCII exactly as UTF-8 does. Other strings up to 5,461 characters are encoded in one pass too, after room for the longest length prefix they can need. The bytes written and the strings read are unchanged.
Buffer growth and the exceptions for malformed payloads were inlined into every generated read and write method. Out of line, the generated code is 15% smaller, and writers 25%.
Code Coverage ReportLine Coverage: 89.7% View detailed coverageCoverage report generated for commit c5768dc |
Single launches varied by up to 15% from one process to the next. The README and RESULTS.md are refreshed with the varint, string and rare-path changes.
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.
No description provided.