Only load Kzg in tests if necessary and only load it once#5555
Merged
mergify[bot] merged 1 commit intosigp:unstablefrom Apr 11, 2024
Merged
Only load Kzg in tests if necessary and only load it once#5555mergify[bot] merged 1 commit intosigp:unstablefrom
mergify[bot] merged 1 commit intosigp:unstablefrom
Conversation
Member
Author
|
This only works in the |
pawanjay176
approved these changes
Apr 11, 2024
Member
pawanjay176
left a comment
There was a problem hiding this comment.
LGTM. Thanks for running the numbers. I'm hoping the das branch in ckzg still has room for optimisations
Member
|
@Mergifyio queue |
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at 7e49f82 |
This was referenced Apr 11, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Addressed
Loading trusted setup file and instantiating the
Kzginstance is very expensive (>80% of test time for most tests), and we're doing this quite a lot of times in tests even when we don't need them (e.g. pre-deneb tests), and in some cases they're loaded twice whenmock_execution_layeris used.This PR improves this by loading
Kzgtrusted setup only once at most, if necessary.Some numbers when I run beacon chain tests locally:
unstablebranch 180s (~17m on CI)unstable+ fix (current branch): 173sdasbranch: 990s (>55m on CI)dasbranch with this fix: 269sThe difference isn't significant on
unstable, so it looks likeKzginitialisation time has increased quite significantly due the changes in thedasversion - there's probably more optimisation that can be done onc-kzgbut we should probably avoid loading it multiple times in a single test anyway, as we run each of these beacon chain tests once per fork.Test command used:
env FORK_NAME=deneb cargo nextest run --release --features "fork_from_env,slasher/lmdb,portable" -p beacon_chain