This modifies DecodeBase58 and EncodeBase58 by processing multiple input bytes at once. For DecodeBase58 we can take 9 bytes at once, and for EncodeBase58 7. This reduces the number of calls of the inner conversion loop.
Benchmark results:
- 37.78 -> 13.73 ns/byte for
Base58Decode, ~2.8 times faster. - 28.81 -> 7.02 ns/byte for
EncodeBase58, ~4.1 times faster.
Note that I tried to improve blockToJSON with this change, but the difference there is not really significant. This optimization might still be relevant though for e.g. listunspents, see #7656