perf: use getStringData to avoid UTF-16→UTF-8 re-encoding on decode#51
Open
GrzywN wants to merge 1 commit intocraftzdog:masterfrom
Open
perf: use getStringData to avoid UTF-16→UTF-8 re-encoding on decode#51GrzywN wants to merge 1 commit intocraftzdog:masterfrom
GrzywN wants to merge 1 commit intocraftzdog:masterfrom
Conversation
Replace .utf8(runtime) in base64ToArrayBuffer with jsi::String::getStringData, which exposes Hermes's internal string representation directly. Base64 strings are always ASCII, so Hermes stores them as compact byte arrays; the ascii=true branch is a near-zero-overhead copy with no encoding step. The ascii=false fallback handles the UTF-16 case by downcasting each char16_t to char, which is safe because all base64 characters fit in the ASCII range.
Owner
|
thanks for your PRs. I think I can find some time to review them two weeks later. |
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.
Replace .utf8(runtime) in base64ToArrayBuffer with jsi::String::getStringData, which exposes Hermes's internal string representation directly. Base64 strings are always ASCII, so Hermes stores them as compact byte arrays; the ascii=true branch is a near-zero-overhead copy with no encoding step. The ascii=false fallback handles the UTF-16 case by downcasting each char16_t to char, which is safe because all base64 characters fit in the ASCII range.
Screenshots