btcsuite / btcutil

Provides bitcoin-specific convenience functions and types
475 stars 408 forks source link

Much faster/cheaper b58 ops #170

Closed ribasushi closed 4 years ago

ribasushi commented 4 years ago

Adds an extra benchmark and dependency on external work by @mr-tron and myself, instead of copying code. Supersedes/closes https://github.com/btcsuite/btcutil/pull/93

Provides significant time/space reduction in address encoding/decoding

ribasushi commented 4 years ago

I apologize, my IDE screwed me over. New push incoming.

ribasushi commented 4 years ago

@Roasbeef @guggero any word on that PR? Anything I need to adjust here or in the imported library? Thanks!

ribasushi commented 4 years ago

Actually I had another insight, which brings the "after" to

pkg: github.com/btcsuite/btcutil/base58
BenchmarkBase58EncodeAddr-8      2690395           436 ns/op      77.94 MB/s          96 B/op          2 allocs/op
BenchmarkBase58DecodeAddr-8      3717728           322 ns/op     146.10 MB/s         128 B/op          2 allocs/op
BenchmarkBase58Encode5k-8            224       5261993 ns/op       0.95 MB/s       13824 B/op          2 allocs/op
BenchmarkBase58Decode5k-8            512       2300409 ns/op       2.97 MB/s       15104 B/op          2 allocs/op

I need to stabilize the new code a bit, and upstream it. Will open a new PR when ready.