This updates the peer module dependencies, the copyright year in the
files modified since the previous release, and serves as a base for
peer/v3.0.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/txscript/v4@v4.0.0
The full list of updated direct dependencies since the previous
peer/v2.2.0 release are as follows:
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/txscript/v4@v4.0.0
- github.com/decred/dcrd/wire@v1.5.0
- github.com/decred/slog@v1.2.0
Finally, all modules in the repository that depend on the module are
tidied to ensure they are updated to use the latest versions hoisted
forward as a result.
This adds an example of calculating the result of dividing a max
unsigned 256-bit integer by a max unsigned 128-bit integer and
outputting that result in hex with leading zeros.
This is part of a series of commits to fully implement the uint256
package.
The following shows the typical performance of converting a standard
library big integer that has already been reduced modulo 2^256 to a
uint256:
Uint256SetBig 26944130 44.45 ns/op 0 B/op 0 allocs/op
This is part of a series of commits to fully implement the uint256
package.
This adds a convenience method for converting a standard library big
integer to a uint256 (modulo 2^256) along with associated tests to
ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.
The following shows the typical performance of converting a uint256 to a
standard library big integer using one that already exists:
Uint256PutBig 43651442 27.29 ns/op 0 B/op 0 allocs/op
This is part of a series of commits to fully implement the uint256
package.
This adds convenience methods for converting a uint256 to a standard
library big integer along with associated tests to ensure proper
functionality.
It includes a method that allows an existing big integer to be reused
thereby potentially saving allocations as well as a method that returns
a new big integer. The latter is often more convenient to use, but is
also virtually guaranteed to cause an allocation.
This is part of a series of commits to fully implement the uint256
package.
This adds full support for formatting a uint256 along with associated
tests to ensure proper functionality.
It includes a fmt.Formatter that supports the full suite of the fmt
package format flags for integral types, a fmt.Stringer, and a separate
Text method that accepts an output base directly and produces the
relevant output with fewer allocations than using the standard fmt
methods.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
---------------------------------------------------------------------
bits_64 2.24ns ± 1% 1.94ns ± 3% -13.04% (p=0.000 n=10+10)
bits_128 2.25ns ± 2% 1.96ns ± 2% -13.17% (p=0.000 n=10+10)
bits_192 2.25ns ± 1% 1.60ns ± 1% -28.65% (p=0.000 n=10+10)
bits_255 2.26ns ± 2% 1.61ns ± 1% -29.04% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
------------------------------------------------------------
bits_64 0.00 0.00 ~ (all equal)
bits_128 0.00 0.00 ~ (all equal)
bits_192 0.00 0.00 ~ (all equal)
bits_255 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds support for determining the minimum number of bits required to
represent the current value of a uint256 along with associated tests to
ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-----------------------------------------------------------------
Xor 17.9ns ± 5% 3.4ns ± 6% -80.91% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
--------------------------------------------------------
Xor 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds support to compute the bitwise xor of two uint256s along with
associated tests to ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-----------------------------------------------------------------
And 16.7ns ± 5% 3.4ns ± 6% -79.93% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
--------------------------------------------------------
And 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds support to compute the bitwise and of two uint256s along with
associated tests to ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-----------------------------------------------------------------
Or 17.9ns ± 5% 3.4ns ± 6% -80.94% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
--------------------------------------------------------
Or 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds support to compute the bitwise or of two uint256s along with
associated tests to ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-----------------------------------------------------------------
Not 25.4ns ± 2% 3.3ns ± 2% -86.79% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
--------------------------------------------------------
Not 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds support to compute the bitwise not of a uint256 along with
associated tests to ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.
This adds support for uint256 bitwise right shifting along with
associated tests to ensure proper functionality.
It includes right shifting an existing uint256 (a >> b) and assigning
the result of right shifting a uint256 to a second one (a >>= b).
This is part of a series of commits to fully implement the uint256
package.
This adds support for uint256 bitwise left shifting along with
associated tests to ensure proper functionality.
It includes left shifting an existing uint256 (a << b) and assigning the
result of left shifting a uint256 to a second one (a <<= b).
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
------------------------------------------------------------------
IsOdd 3.62ns ± 4% 1.64ns ± 1% -54.65% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
---------------------------------------------------------
IsOdd 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds the ability to determine if a uint256 is odd along with
associated tests to ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-------------------------------------------------------------------
Negate 47.3ns ± 2% 1.5ns ± 2% -96.91% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
----------------------------------------------------------
Negate 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds support for uint256 negation (modulo 2^256) along with
associated tests to ensure proper functionality.
It includes negating an existing uint256 (a = -a) and assigning the
result of negating a uint256 to a second one (a = -b).
This is part of a series of commits to fully implement the uint256
package.
This adds support for uint256 division (modulo 2^256) along with
associated tests to ensure proper functionality.
It includes dividing an existing uint256 by a second one (a /= b),
dividing two uint256s and assigning the result to a third (a = b/c), and
dividing an existing uint256 by a uint64 (a /= uint256(b)).
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-------------------------------------------------------------------
Square 418ns ± 0% 7ns ± 2% -98.39% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
--------------------------------------------------------------------
Square 1.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10)
This is part of a series of commits to fully implement the uint256
package.
This adds support for uint256 squaring (modulo 2^256) along with
associated tests to ensure proper functionality.
It includes squaring an existing uint256 (a *= a) and assigning the
result of squaring a uint256 to a second one (a = b*b).
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
----------------------------------------------------------------------
Mul 419ns ± 1% 10ns ± 1% -97.64% (p=0.000 n=10+10)
MulUint64 263ns ± 1% 4ns ± 1% -98.30% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
-----------------------------------------------------------------------
Mul 1.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10)
MulUint64 1.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10)
This is part of a series of commits to fully implement the uint256
package.
This adds support for uint256 multiplication (modulo 2^256) along with
associated tests to ensure proper functionality.
It includes multiplying a uint256 with an existing one (a *= b),
multiplying two uint256s and assigning the result to a third (a = b *
c), and multiplying an existing uint256 with a uint64 (a *= uint256(b)).
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
---------------------------------------------------------------------
Sub 53.9ns ± 1% 2.1ns ± 1% -96.12% (p=0.000 n=10+10)
SubUint64 44.8ns ± 1% 3.4ns ± 2% -92.37% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
-------------------------------------------------------------
Sub 0.00 0.00 ~ (all equal)
SubUint64 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds support for uint256 subtraction (modulo 2^256) along with
associated tests to ensure proper functionality.
It includes subtracting a uint256 from an existing one (a -= b),
subtracting two uint256s and assigning the result to a third (a = b -
c), and subtracting a uint64 from an existing uint256 (a -= uint256(b)).
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
----------------------------------------------------------------------
Add 158.0ns ± 2% 2.0ns ± 1% -98.67% (p=0.000 n=10+10)
AddUint64 44.4ns ± 3% 3.4ns ± 2% -92.27% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
-------------------------------------------------------------
Add 0.00 0.00 ~ (all equal)
AddUint64 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds support for uint256 addition (modulo 2^256) along with
associated tests to ensure proper functionality.
It includes adding a uint256 to an existing one (a += b), adding two
uint256s and assigning the result to a third (a = b + c), and adding a
uint64 to an existing uint256 (a += uint256(b)).
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
----------------------------------------------------------------------
Cmp 12.6ns ± 1% 7.7ns ± 1% -39.01% (p=0.000 n=10+10)
CmpUint64 5.93ns ± 2% 3.7ns ± 1% -37.60% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
-------------------------------------------------------------
Cmp 0.00 0.00 ~ (all equal)
CmpUint64 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds the ability to compare a uint256 to another uint256 or a
uint64 along with associated tests to ensure proper functionality.
The comparison logic is the usual logic where -1 is returned when the
uint256 is less than the value being compared to, 0 when it is equal,
and 1 when it is greater.
This is part of a series of commits to fully implement the uint256
package.
This adds the ability to determine if a uint256 is greater than or equal
to another uint256 or a uint64 along with associated tests to ensure
proper functionality.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-----------------------------------------------------------------
Gt 12.6ns ± 1% 3.0ns ± 1% -75.91% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
--------------------------------------------------------
Gt 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds the ability to determine if a uint256 is greater than another
uint256 or a uint64 along with associated tests to ensure proper
functionality.
This is part of a series of commits to fully implement the uint256
package.
This adds the ability to determine if a uint256 is less than or equal to
another uint256 or a uint64 along with associated tests to ensure proper
functionality.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-----------------------------------------------------------------
Lt 12.6ns ± 1% 3.0ns ± 1% -75.96% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
--------------------------------------------------------
Lt 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds the ability to determine if a uint256 is less than another
uint256 or a uint64 along with associated tests to ensure proper
functionality.
This is part of a series of commits to fully implement the uint256
package.
The following is a comparison between stdlib big integers (old) and the
specialized type (new) averaging 10 runs each:
name old time/op new time/op delta
-----------------------------------------------------------------
Eq 12.7ns ± 1% 2.1ns ± 1% -83.72% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
--------------------------------------------------------
Eq 0.00 0.00 ~ (all equal)
This is part of a series of commits to fully implement the uint256
package.
This adds the ability to determine if a uint256 represents the same
value as another uint256 or as a uint64 along with associated tests to
ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.
This adds the ability to determine if a uint256 can be converted to a
uint64 without any loss of precision as well a method to cast it along
with associated tests to ensure proper functionality.
This is part of a series of commits to fully implement the uint256
package.