-
Notifications
You must be signed in to change notification settings - Fork 213
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize hexadecimal decoding #568
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.
Thank you for your help on go-toml!
Out of curiosity, do you have benchmarks for this function? The existing benchmarks show no time improvement, but I suspect parsing hex strings represents a minority of the time in those.
Before merging this I'd love to see a better-or-equal execution time and allocations benchmark (I'm fine with equal, just want to check for regressions), as well as handling non-hex characters correctly.
Thank you!
sorry, i forgot to name it clearly. hexToString2 test is new function, 8.828 ns/op, 4.5x faster than old one... |
Doh! I'm sorry, I somehow didn't see the benchmark in the PR description. Pushed a commit to benchmark using Benchmarks: Baseline vs new hex2string implementation
Baseline vs direct hex2rune call
Side by side
|
I'm going to merge this as is given the significant improvement. Thank you so much for your patch and your help in improving go-toml! |
simple optimize hexToString..
hexToRune is copy from encoding/json
benchmark