sql: remove extra allocation when parsing x'val' literals
Scanning x'val' literals does an extra copy and allocation, since scanString returns a string that the literal parser just converts into bytes and back when using hex.DecodeString. Remove this extra work.
From @petermattis's comment on #7138:
It's mildly unfortunate for scanString to scan into a buf []byte, then convert that to a string before returning just so it can be passed to hex.DecodeString. It might be better to pass an additional flag to scanString so that we could call hex.Decode(buf) instead, avoiding an allocation and a copy. Also, it looks like hex.Decode(buf, buf) works as the writing to the output trails the input. This would avoid an additional allocation.
Am starting out with golang and would be interested to work on this with some help if that is fine.
Your submission is welcome - prepare a pull request following the contributing guidelines and one of us will be happy to review your code. Thanks!
Working on this issue.Just for info.