You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jatie1 (via GitHub)" <gi...@apache.org> on 2024/12/11 13:15:49 UTC
[PR] Simplify hex methods [commons-codec]
Jatie1 opened a new pull request, #347:
URL: https://github.com/apache/commons-codec/pull/347
Update methods encodeHex and decodeHex to simplify the code and make it slightly more efficient.
encodeHex: don't compute dataOffset + dataLen on every for iteration and also standardize nibble high and low using Base16.encode() as inspiration. I would say it's easier to read now.
decodeHex: get high and low nibble directly using for loop iterator incrementing by 2 (2 char per hex val) and OR them immediately instead of getting high nibble, iterating variable, ORing low nibble, iterating variable then converting to byte. I think it's far more readable this way.
I tested both with a barebones jmh benchmark and speed is roughly the same or very slightly faster than old implementation for both.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Simplify hex methods [commons-codec]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #347:
URL: https://github.com/apache/commons-codec/pull/347#issuecomment-2558577029
Closing: No reply in 2 weeks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Simplify hex methods [commons-codec]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #347:
URL: https://github.com/apache/commons-codec/pull/347#issuecomment-2536019917
Hello @Jatie1
Please update the PR so anyone can run your JMH benchmarks.
Thank you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Simplify hex methods [commons-codec]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory closed pull request #347: Simplify hex methods
URL: https://github.com/apache/commons-codec/pull/347
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org