Skip to content
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

uint256: Introduce package. #2787

Merged
merged 59 commits into from
Nov 20, 2021
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
97526bd
uint256: Introduce package infrastructure.
davecgh Nov 6, 2021
6beb1b3
uint256: Add set from big endian bytes.
davecgh Nov 6, 2021
e785c25
uint256: Add big endian set benchmarks.
davecgh Nov 6, 2021
2bec2b5
uint256: Add set from little endian bytes.
davecgh Nov 6, 2021
d838d58
uint256: Add little endian set benchmarks.
davecgh Nov 6, 2021
7fbfaac
uint256: Add get big endian bytes.
davecgh Nov 6, 2021
aafccab
uint256: Add big endian get benchmarks.
davecgh Nov 6, 2021
466ebf9
uint256: Add get little endian bytes.
davecgh Nov 6, 2021
2f2d347
uint256: Add little endian get benchmarks.
davecgh Nov 6, 2021
8952fc5
uint256: Add zero support.
davecgh Nov 6, 2021
99f214c
uint256: Add zero benchmarks.
davecgh Nov 6, 2021
90315bf
uint256: Add uint32 casting support.
davecgh Nov 6, 2021
b46ff5e
uint256: Add uint64 casting support.
davecgh Nov 6, 2021
ed6ef23
uint256: Add equality comparison support.
davecgh Nov 6, 2021
393c7d6
uint256: Add equality comparison benchmarks.
davecgh Nov 6, 2021
e574a5f
uint256: Add less than comparison support.
davecgh Nov 6, 2021
7e9ed05
uint256: Add less than comparison benchmarks.
davecgh Nov 6, 2021
4831b21
uint256: Add less or equals comparison support.
davecgh Nov 6, 2021
c1b94c2
uint256: Add greater than comparison support.
davecgh Nov 6, 2021
dd40c57
uint256: Add greater than comparison benchmarks.
davecgh Nov 6, 2021
e8ba80e
uint256: Add greater or equals comparison support.
davecgh Nov 6, 2021
2d86902
uint256: Add general comparison support.
davecgh Nov 6, 2021
5b08928
uint256: Add general comparison benchmarks.
davecgh Nov 6, 2021
ff8c41c
uint256: Add addition support.
davecgh Nov 6, 2021
e6b423b
uint256: Add addition benchmarks.
davecgh Nov 6, 2021
90d4ba8
uint256: Add subtraction support.
davecgh Nov 6, 2021
fe684af
uint256: Add subtraction benchmarks.
davecgh Nov 6, 2021
8cfc4dc
uint256: Add multiplication support.
davecgh Nov 6, 2021
fa9f70e
uint256: Add multiplication benchmarks.
davecgh Nov 6, 2021
dc2a08f
uint256: Add squaring support.
davecgh Nov 6, 2021
8d27f65
uint256: Add squaring benchmarks.
davecgh Nov 6, 2021
7ef9c18
uint256: Add division support.
davecgh Nov 6, 2021
ff68ec7
uint256: Add division benchmarks.
davecgh Nov 6, 2021
d92a330
uint256: Add negation support.
davecgh Nov 6, 2021
768cf62
uint256: Add negation benchmarks.
davecgh Nov 6, 2021
944a888
uint256: Add is odd support.
davecgh Nov 6, 2021
66e2409
uint256: Add is odd benchmarks.
davecgh Nov 6, 2021
1114a41
uint256: Add bitwise left shift support.
davecgh Nov 6, 2021
7844489
uint256: Add bitwise left shift benchmarks.
davecgh Nov 6, 2021
0084625
uint256: Add bitwise right shift support.
davecgh Nov 6, 2021
6fd319e
uint256: Add bitwise right shift benchmarks.
davecgh Nov 6, 2021
a42b8c8
uint256: Add bitwise not support.
davecgh Nov 6, 2021
3ce3e33
uint256: Add bitwise not benchmarks.
davecgh Nov 6, 2021
269eee2
uint256: Add bitwise or support.
davecgh Nov 6, 2021
33601a0
uint256: Add bitwise or benchmarks.
davecgh Nov 6, 2021
97bdac8
uint256: Add bitwise and support.
davecgh Nov 6, 2021
275afa2
uint256: Add bitwise and benchmarks.
davecgh Nov 6, 2021
d176920
uint256: Add bitwise xor support.
davecgh Nov 6, 2021
7ba863d
uint256: Add bitwise xor benchmarks.
davecgh Nov 6, 2021
c0854f6
uint256: Add bit length support.
davecgh Nov 6, 2021
37b4c65
uint256: Add bit length benchmarks.
davecgh Nov 6, 2021
4f7eaa8
uint256: Add text formatting support.
davecgh Nov 6, 2021
4653cbc
uint256: Add text formatting benchmarks.
davecgh Nov 6, 2021
6065dd8
uint256: Add conversion to stdlib big int support.
davecgh Nov 6, 2021
15eac53
uint256: Add conversion to stdlib big int benchmark.
davecgh Nov 6, 2021
8dbc97e
uint256: Add conversion from stdlib big int support.
davecgh Nov 6, 2021
3d83510
uint256: Add conversion from stdlib big int benchmark.
davecgh Nov 6, 2021
7abc0d9
uint256: Add basic usage example.
davecgh Nov 6, 2021
8f3fd5a
uint256: Add README.md.
davecgh Nov 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
uint256: Add conversion to stdlib big int benchmark.
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.
davecgh committed Nov 19, 2021
commit 15eac536d153925f8d3c3dc32a6ae199c5efb637
16 changes: 16 additions & 0 deletions internal/staging/primitives/uint256/uint256_bench_test.go
Original file line number Diff line number Diff line change
@@ -1291,3 +1291,19 @@ func BenchmarkBigIntFormat(b *testing.B) {
})
}
}

// BenchmarkUint256PutBig benchmarks converting an unsigned 256-bit integer to a
// stdlib big integer.
func BenchmarkUint256PutBig(b *testing.B) {
n := new(big.Int)
vals := randBenchVals

b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i += len(vals) {
for j := 0; j < len(vals); j++ {
val := &vals[j]
val.n1.PutBig(n)
}
}
}