-
Notifications
You must be signed in to change notification settings - Fork 725
[Backport] Base58 performance improvements #1676
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
[Backport] Base58 performance improvements #1676
Conversation
- fix Decode call (req. only one param) - add constructor for base58c->CExtKey coming from btc@7cb1f9f7eb8162a792b4b87bba99fa21c682582e
coming from btc@8d2af54eccda83bfe86bb14069ad54d0e4ba357c
Improve DecodeBase58 performance the same way as commit 3252208 did for EncodeBase58.
SetString seems to be passing the length of the wrong variable to memory_cleanse, resulting in the last byte of the temporary buffer not being securely erased.
random-zebra
left a comment
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.
ACK aa633c8
Really nice improvement.
Here's some number:
With master (at 4c829bb):
#Benchmark,count,min(ns),max(ns),average(ns),min_cycles,max_cycles,average_cycles
Base58CheckEncode,131072,7708,8182,7845,20041,21275,20399
Base58Decode,294912,3526,3642,3584,9168,9470,9321
Base58Encode,196608,5491,5620,5544,14278,14612,14415
With this PR (rebased on master)
#Benchmark,count,min(ns),max(ns),average(ns),min_cycles,max_cycles,average_cycles
Base58CheckEncode,212992,4852,5097,4898,12618,13252,12737
Base58Decode,393216,2600,2747,2674,6762,7142,6953
Base58Encode,327680,3189,3583,3252,8292,9315,8455
So, encoding is 37.5% and 41% faster (respectively for Base58CheckEncode and Base58Encode), and decoding is 25% faster, on average.
Fuzzbawls
left a comment
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.
ACK aa633c8
Master:
#Benchmark,count,min(ns),max(ns),average(ns),min_cycles,max_cycles,average_cycles
Base58CheckEncode,229376,4496,4529,4517,16185,16307,16261
Base58Decode,851968,1215,1224,1217,4374,4409,4384
Base58Encode,327680,3094,3145,3107,11139,11325,11187
Master + This PR:
#Benchmark,count,min(ns),max(ns),average(ns),min_cycles,max_cycles,average_cycles
Base58CheckEncode,360448,2891,2925,2900,10410,10533,10443
Base58Decode,1441792,713,721,717,2570,2597,2582
Base58Encode,589824,1767,1784,1777,6364,6423,6398
Coming from: