mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 05:17:22 +00:00
f4778048ac
* allow to jump over 50K skipped slots * more tests * removes debug logs * minor fixes * re-arrage pid updates * optimizes queue and fsm * Merge branch 'master' into init-sync-arbitrary-batch-len * fixes benchmark test * Merge branch 'master' into init-sync-arbitrary-batch-len * queue cleanup * updates polling interval * fsm test: allMachinesInState * fsm test: highestStartBlock * rest of fsm tests * Merge branch 'master' into init-sync-arbitrary-batch-len * Merge refs/heads/master into init-sync-arbitrary-batch-len * Merge refs/heads/master into init-sync-arbitrary-batch-len * Merge refs/heads/master into init-sync-arbitrary-batch-len * Merge refs/heads/master into init-sync-arbitrary-batch-len * Merge refs/heads/master into init-sync-arbitrary-batch-len * parse machines in order * Merge branch 'init-sync-arbitrary-batch-len' of github.com:prysmaticlabs/prysm into init-sync-arbitrary-batch-len
40 lines
883 B
Go
40 lines
883 B
Go
package initialsync
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkStateMachine_trigger(b *testing.B) {
|
|
sm := newStateMachineManager()
|
|
|
|
handlerFn := func(m *stateMachine, in interface{}) (id stateID, err error) {
|
|
response, ok := in.(*fetchRequestParams)
|
|
if !ok {
|
|
return 0, errInputNotFetchRequestParams
|
|
}
|
|
_ = response.count
|
|
return stateScheduled, nil
|
|
}
|
|
|
|
sm.addEventHandler(eventTick, stateNew, handlerFn)
|
|
sm.addEventHandler(eventTick, stateScheduled, handlerFn)
|
|
sm.addEventHandler(eventTick, stateDataParsed, handlerFn)
|
|
sm.addEventHandler(eventTick, stateSkipped, handlerFn)
|
|
sm.addEventHandler(eventTick, stateSent, handlerFn)
|
|
sm.addStateMachine(64)
|
|
|
|
b.ReportAllocs()
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
data := &fetchRequestParams{
|
|
start: 23,
|
|
count: 32,
|
|
}
|
|
err := sm.machines[64].trigger(eventTick, data)
|
|
if err != nil {
|
|
b.Fatal(err)
|
|
}
|
|
}
|
|
}
|