Skip to content

Conversation

@MariusVanDerWijden
Copy link
Owner

No description provided.

MariusVanDerWijden added a commit that referenced this pull request Dec 1, 2022
all: implement forkid changes for shanghai
MariusVanDerWijden pushed a commit that referenced this pull request Jan 23, 2023
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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants