refactor: small optimization for IsHex method#16310
refactor: small optimization for IsHex method#16310shargon wants to merge 1 commit intobitcoin:masterfrom
Conversation
|
Please fix your commit messages and remove the merge commit. As this is an |
promag
left a comment
There was a problem hiding this comment.
This change supposedly optimizes the false case, I don't think it matters.
In the case of false, we check every character first, not needed Small optimization for IsHex method [size==0]
@jcliff and in other cases adds more "computation". I suspect a benchmark would give similar results, and in that case why bother? |
|
Is there any user-visible (or, network-visible) behavior that this would speed up? Thank you for your first contribution, but we're kind of strict in this project as to requiring a strong rationale for every change. It takes effort to review a change, and there's always a risk. |
|
Closing this, sorry, there is no agreement to do this |
In case the condition is
false, every character is checked first. This operation is not necessary.If you call the method with a truncated hex string, you will loose performance. The last check will be done, so is better to do it the first one