forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto/kzg: Faster blob transaction verification (ethereum#14)
When computing the aggregated KZG proof, a good chunk of the runtime is spent on the barycentric evaluation. The most expensive operation during the polynomial evaluation is the modular inverse as we divide the polynomial by each root of unity (scaled by z). We precompute the moduular inverses of each divisor as a batch to speed up evaluation. This yields gives us a 3x improvement in the latency of verifying blob transactions: Before ``` go test -benchmem -run='^$' -bench '^BenchmarkVerifyMultiple$' github.com/ethereum/go-ethereum/tests goos: linux goarch: amd64 pkg: github.com/ethereum/go-ethereum/tests cpu: AMD Ryzen 7 3700X 8-Core Processor BenchmarkVerifyMultiple/8-6 5 216293524 ns/op 23122608 B/op 432644 allocs/op BenchmarkVerifyMultiple/16-6 3 429942571 ns/op 46245757 B/op 865270 allocs/op PASS ok github.com/ethereum/go-ethereum/tests 33.350s ``` After: ``` go test -benchmem -run='^$' -bench '^BenchmarkVerifyMultiple$' github.com/ethereum/go-ethereum/tests goos: linux goarch: amd64 pkg: github.com/ethereum/go-ethereum/tests cpu: AMD Ryzen 7 3700X 8-Core Processor BenchmarkVerifyMultiple/8-6 16 69890960 ns/op 25221325 B/op 399904 allocs/op BenchmarkVerifyMultiple/16-6 8 138506286 ns/op 50439658 B/op 799792 allocs/op PASS ok github.com/ethereum/go-ethereum/tests 20.170s ```
- Loading branch information
Showing
4 changed files
with
23 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters