Closed Inphi closed 1 year ago
Hello!
I just merged https://github.com/crate-crypto/go-proto-danksharding-crypto/pull/6 which gave me a considerable difference on the startup time.
Let me know if that helps and I'll open a PR to move it into geth
Thanks. That did help and also removing the init function made it possible for users to initialize the crypto context only when it's needed.
The
eth
package contains aninit
function that takes a while to run setup a crypto context. As a result all downstream users of the package end up incurring the cost of initialization even when the eth package isn't used at runtime. In particular, go-ethereum has several utilities that indirectly pull downeth
and these utilities are used for test generators, retesteth and python tests. These utilities are run repeatedly and ideally should have quick startup times.I've narrowed down the issue to be the api.parseTrustedSetup. Here's a flamegraph of a sample run. Here the init function took 300ms to run on my machine:
Dunno how feasible it'd be to optimize parsing the trusted setup such that init runs in under 10 milliseconds. Though even deferred initialization until the user uses the crypto context would work too. Most short-lived runs in go-ethereum do not use
eth
.