6d2a2ebadf
* Remove custody (#3986)
* Update proto fields
* Updated block operations
* Fixed all block operation tests
* Fixed tests part 1
* Fixed tests part 1
* All tests pass
* Clean up
* Skip spec test
* Fixed ssz test
* Skip ssz test
* Skip mainnet tests
* Update beacon-chain/operations/attestation.go
* Update beacon-chain/operations/attestation.go
* Decoy flip flop check (#3987)
* Bounce attack check (#3989)
* New store values
* Update process block
* Update process attestation
* Update tests
* Helper
* Fixed blockchain package tests
* Update beacon-chain/blockchain/forkchoice/process_block.go
* Conflict
* Unskip mainnet spec tests (#3998)
* Starting
* Fixed attestation mainnet test
* Unskip ssz static and block processing tests
* Fixed workspace
* fixed workspace
* fixed workspace
* Update beacon-chain/core/blocks/block_operations.go
* Unskip minimal spec tests (#3999)
* Starting
* Fixed attestation mainnet test
* Unskip ssz static and block processing tests
* Fixed workspace
* fixed workspace
* fixed workspace
* Update workspace
* Unskip all minimal spec tests
* Update workspace for general test
* Unskip test (#4001)
* Update minimal seconds per slot to 6 (#3978)
* Bounce attack tests (#3993)
* New store values
* Update process block
* Update process attestation
* Update tests
* Helper
* Fixed blockchain package tests
* Slots since epoch starts tests
* Update justified checkpt tests
* Conflict
* Fixed logic
* Update process_block.go
* Use helper
* Conflict
* Merge branch 'master' of https://github.com/prysmaticlabs/prysm into v0.9.1
* Conflict
* Fixed failed tests
* Lower MinGenesisActiveValidatorCount to 16384 (#4100)
* Fork choice beacon block checks (#4107)
* Prevent future blocks check and test
* Removed old code
* Update aggregation proto (#4121)
* Update def
* Update spec test
* Conflict
* Update workspace
* patch
* Resolve conflict
* Patch
* Change workspace
* Update ethereumapis to a forked branch at commit
|
||
---|---|---|
.. | ||
benchmark_files | ||
benchmarks_test.go | ||
BUILD.bazel | ||
config.go | ||
README.md |
Benchmarks for Prysm State Transition
This package contains the functionality needed for benchmarking Prysms state transitions, this includes its block processing (with and without caching) and epoch processing functions. There is also a benchmark for HashTreeRoot on a large beacon state.
Benchmark Configuration
The following configs are in config.go
:
ValidatorCount
: Sets the amount of active validators to perform the benchmarks with. Default is 65536.AttestationsPerEpoch
: Sets the amount of attestations per epoch for the benchmarks to perform with, this affects the amount of attestations in a full block and the amount of attestations per epoch in the state for theProcessEpoch
andHashTreeRoot
benchmark. Default is 128.
Generating new SSZ files
Due to the sheer size of the benchmarking configurations (65536 validators), the files used for benchmarking are pregenerated so there's no wasted computations on generating a genesis state with 65536 validators. This should only be needed if there is a breaking spec change and the tests fail from SSZ issues.
To generate new files to use for benchmarking, run the below command in the root of Prysm.
go run beacon-chain/core/state/benchmarks/benchmark_files/generate_bench_files.go
Bazel does not allow writing to the project directory, so running with go run
is needed.
Running the benchmarks
To run the ExecuteStateTransition benchmark:
bazel test //beacon-chain/core/state/benchmarks:go_default_test --test_filter=BenchmarkExecuteStateTransition_FullBlock --test_arg=-test.bench=BenchmarkExecuteStateTransition_FullBlock
To run the ExecuteStateTransition (with cache) benchmark:
bazel test //beacon-chain/core/state/benchmarks:go_default_test --test_filter=BenchmarkExecuteStateTransition_WithCache --test_arg=-test.bench=BenchmarkExecuteStateTransition_WithCache
To run the ProcessEpoch benchmark:
bazel test //beacon-chain/core/state/benchmarks:go_default_test --test_filter=BenchmarkProcessEpoch_2FullEpochs --test_arg=-test.bench=BenchmarkProcessEpoch_2FullEpochs
To run the HashTreeRoot benchmark:
bazel test //beacon-chain/core/state/benchmarks:go_default_test --test_filter=BenchmarkHashTreeRoot_FullState --test_arg=-test.bench=BenchmarkHashTreeRoot_FullState
To run the HashTreeRootState benchmark:
bazel test //beacon-chain/core/state/benchmarks:go_default_test --test_filter=BenchmarkHashTreeRootState_FullState --test_arg=-test.bench=BenchmarkHashTreeRootState_FullState
Extra flags needed to benchmark properly:
--nocache_test_results --test_arg=-test.v --test_timeout=2000 --test_arg=-test.cpuprofile=/tmp/cpu.profile --test_arg=-test.memprofile=/tmp/mem.profile --test_output=streamed
Current Results as of November 2019
BenchmarkExecuteStateTransition-4 20 33020593584 ns/op
BenchmarkExecuteStateTransition_WithCache-4 20 21272276477 ns/op
BenchmarkProcessEpoch_2FullEpochs-4 5 158161708836 ns/op
BenchmarkHashTreeRoot_FullState-4 50 1509721280 ns/op
BenchmarkHashTreeRootState_FullState-4 50 67622586 ns/op