btcsuite / btcutil

Provides bitcoin-specific convenience functions and types
480 stars 410 forks source link

base58: improve encode and decode performance #183

Closed egonelbre closed 3 years ago

egonelbre commented 4 years ago

Individual operations on big.Int values are slow, hence do computations up to 58^10 using an uint64. This makes the code roughly 10x faster.

calebcase commented 3 years ago

Anything we can do to get this reviewed?

egonelbre commented 3 years ago

@onyb hopefully, that's sufficient.

egonelbre commented 3 years ago

@onyb ping, is there anything else that needs to be improved?

onyb commented 3 years ago

@egonelbre Thanks for the reminder. I got busy with reviewing some of btcd PRs. Will take a deeper look today or tomorrow, and most likely have it merged on Tuesday (during our weekly sync meeting).

onyb commented 3 years ago

One last thing - could you please pull in the latest test cases from Bitcoin Core? Here's the link: https://github.com/bitcoin/bitcoin/blob/master/src/test/data/base58_encode_decode.json

egonelbre commented 3 years ago

@onyb ping.

jcvernaleo commented 3 years ago

Just going to add that most of the time we prefer to squash to single commits but in this case I think the three commits make very logic sense so leaving them un-squashed is good.

And thanks!