Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-121562: optimized hex_from_char#121563
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM in principle. The old code is agnostic to character encoding (works equally well with ASCII / EBCDIC / whatever), while the new code is based on the bytes of the UTF8-encoded string. That's fine, since the only use-case is applying this to a UTF-8-encoded value. But please could we add a comment that makes it clear that this table should only be used with encodings whose lower half is ASCII (like UTF-8).
Hello@mdickinson, thanks for your time, I just added the comment clarifying it but my English is average, anything let me know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for the update; the comment looks good.
@LimaBD Merged. Thank you for the contribution! |
Performance improvement to `float.fromhex`: use a lookup tablefor computing the hexadecimal value of a character, in place of theprevious switch-case construct. Patch by Bruno Lima.
Uh oh!
There was an error while loading.Please reload this page.
Optimized hex_from_char performance
issue#121562
Timing with old hex_from_char:
With new hex_from_char:
If we measure
hex_from_chardirectly, probably we will get a much better % improvement because there is additional calls thatfloat.fromhexmakes apart from this one.