Commit graph

20 commits

Author SHA1 Message Date
Brannon King e72f99ac3f renamed package to lbcutil, updated refs to it 2021-09-10 16:37:45 -04:00
Josh Bleecher Snyder a53e38424c base58: allocate less in Encode
* calculate maximum output length more precisely
  to avoid allocation in the append
* use big.Int.Sign instead of needing bigZero

name                 old time/op    new time/op    delta
Base58Encode_5K-8      5.86ms ± 3%    5.79ms ± 2%   -1.27%  (p=0.035 n=9+10)
Base58Encode_100K-8     2.23s ± 1%     2.23s ± 0%     ~     (p=0.074 n=9+8)
Base58Decode_5K-8       281µs ± 1%     282µs ± 1%     ~     (p=0.720 n=9+10)
Base58Decode_100K-8    89.4ms ± 7%    88.3ms ± 7%     ~     (p=0.123 n=10+10)

name                 old speed      new speed      delta
Base58Encode_5K-8     854kB/s ± 3%   864kB/s ± 2%     ~     (p=0.134 n=9+10)
Base58Encode_100K-8  40.0kB/s ± 0%  40.0kB/s ± 0%     ~     (all equal)
Base58Decode_5K-8    24.3MB/s ± 1%  24.2MB/s ± 1%     ~     (p=0.644 n=9+10)
Base58Decode_100K-8  1.53MB/s ± 7%  1.55MB/s ± 7%     ~     (p=0.218 n=10+10)

name                 old alloc/op   new alloc/op   delta
Base58Encode_5K-8      28.7kB ± 0%    19.2kB ± 0%  -33.03%  (p=0.000 n=10+10)
Base58Encode_100K-8     557kB ± 0%     385kB ± 0%  -30.88%  (p=0.000 n=10+10)
Base58Decode_5K-8       349kB ± 0%     349kB ± 0%     ~     (all equal)
Base58Decode_100K-8     133MB ± 0%     133MB ± 0%     ~     (p=0.183 n=10+10)

name                 old allocs/op  new allocs/op  delta
Base58Encode_5K-8        5.00 ± 0%      4.00 ± 0%  -20.00%  (p=0.000 n=10+10)
Base58Encode_100K-8      5.00 ± 0%      4.00 ± 0%  -20.00%  (p=0.000 n=10+10)
Base58Decode_5K-8         129 ± 0%       129 ± 0%     ~     (all equal)
Base58Decode_100K-8     2.51k ± 0%     2.51k ± 0%     ~     (p=0.321 n=10+10)

When Go 1.16 is released, performance will improve
significantly due to improvements to math/big.Int's division implementation.
2020-12-08 09:37:02 -05:00
Egon Elbre 4031bdc69d base58: add new testcases from github.com/bitcoin 2020-11-24 13:21:44 -05:00
Egon Elbre 594180da5d base58: optimize Decode
Before:
    BenchmarkBase58Decode_5K-32     266      4373774 ns/op  1.56 MB/s
    BenchmarkBase58Decode_100K-32   1     1516196700 ns/op  0.09 MB/s

After:
    BenchmarkBase58Decode_5K-32     3868      277944 ns/op  24.57 MB/s
    BenchmarkBase58Decode_100K-32   13      83772100 ns/op   1.63 MB/s
2020-11-24 13:21:44 -05:00
Egon Elbre ed1fc7ad99 base58: optimize Encode
Before:
    BenchmarkBase58Encode_5K-32     46      23934763 ns/op  0.21 MB/s
    BenchmarkBase58Encode_100K-32    1    9351948600 ns/op  0.01 MB/s

After:
    BenchmarkBase58Encode_5K-32    501       2419129 ns/op  2.07 MB/s
    BenchmarkBase58Encode_100K-32    2     923507950 ns/op  0.11 MB/s
2020-11-24 13:21:44 -05:00
Steven Roose 4443e04cb8 Fix error in base58check test 2020-07-13 09:35:42 -04:00
Dave Collins fac8a9a582
multi: Update markdown files for GFM changes.
The github markdown interpreter has been changed such that it no longer
allows spaces in between the brackets and parenthesis of links.  This
updates all of the markdown files accordingly.

While here, it also corrects a couple of inconsistencies in regards to
other README.md files in the project.
2017-05-25 13:01:10 -05:00
David Hill a5ecb5d954 travis: +go 1.8.x -go 1.6.x (#94) 2017-04-19 10:14:49 -04:00
David Hill 86346b5a95 build: Add gosimple linter to goclean.sh 2017-01-11 15:38:44 -05:00
Dave Collins e8bab6bc19 docs: Make various README.md files consistent.
First, it removes the documentation section from all the README.md files
and instead puts a web-based godoc badge and link at the top with the
other badges. This is being done since the local godoc tool no longer
ships with Go by default, so the instructions no longer work without
first installing godoc. Due to this, pretty much everyone uses the
web-based godoc these days anyways. Anyone who has manually installed
godoc won't need instructions.

Second, it makes sure the ISC license badge is at the top with the other
badges and removes the textual reference in the overview section.

Third, it's modifies the Installation section to Installation and
Updating and adds a -u to the go get command since it works for both and
thus is simpler.

Finally, it replaces the badges with SVG versions from shields.io so
they are consistent.
2015-10-23 17:17:38 -05:00
Dave Collins 1b73e9828d Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
Josh Rickmar dca623d4ef Optimize base58 decoding.
This change introduces an autogenerated base58 digit table to remove
the need to find the index of a character in the modified base58
alphabet each time.  Additionally, it removes some unnecessary big
integer allocations to cut down on the GC churn.

Before:
BenchmarkBase58Encode         20          64998995 ns/op           0.08 MB/s
BenchmarkBase58Decode         50          35965928 ns/op           0.19 MB/s

Now:
BenchmarkBase58Encode         20          64644351 ns/op           0.08 MB/s
BenchmarkBase58Decode        200           7914748 ns/op           0.86 MB/s
2015-01-24 14:59:51 -05:00
Dave Collins f80c4d718d Update btcutil import paths in README.md files. 2015-01-15 21:35:29 -06:00
Dave Collins 506d333934 Update btcutil import paths to new location. 2015-01-15 15:13:38 -06:00
Dave Collins 97fea16721 Add package documentation for base58 package.
This commit adds a doc.go file in the base58 package which provides
package documentation for godoc.
2014-12-22 12:36:34 -06:00
Dave Collins ff8cbd1786 Add testable examples for base58 package.
This commit creates and an example test file for the baes58 package that
integrates nicely with Go's example tooling.

This allows the example output to be tested as a part of running the
normal Go tests to help ensure it doesn't get out of date with the code.
2014-12-22 11:58:06 -06:00
Dave Collins cef307c87e Complete base58 migration to new package. 2014-12-22 10:56:00 -06:00
Dave Collins fffd6a2e87 Add benchmarks to base58 package. 2014-12-22 10:45:21 -06:00
Dave Collins a630ef8247 A few minor modifications to new base58 package.
- Call out in README.md that this is modified base58 (it's not the same as
  normal base58)
- Remove the blurb about test_coverage.txt since it is no longer needed
  now that the repo now has coveralls integrated
- Rename base58_check[_test].go -> basecheck[_test].go.  Since Go treats
  _<ext> special in some cases like for tests and conditional OS and
  architecture compilation, it's a good idea to avoid naming files with
  them to ensure a new special meaning doesn't break builds in the future
2014-12-22 10:29:07 -06:00
benma a72a54be16 Create a new sub-package base58.
It consists of the previous base58 implementation and new
base58 check encoding/decoding functions.
2014-12-22 11:43:07 +01:00