2023-10-03 20:41:55 +00:00
|
|
|
package state_native_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
state_native "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
2023-10-03 20:41:55 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkParticipationBits(b *testing.B) {
|
|
|
|
st, err := state_native.InitializeFromProtoCapella(ðpb.BeaconStateCapella{})
|
|
|
|
require.NoError(b, err)
|
|
|
|
|
|
|
|
max := uint64(16777216)
|
|
|
|
for i := uint64(0); i < max-2; i++ {
|
|
|
|
require.NoError(b, st.AppendCurrentParticipationBits(byte(1)))
|
|
|
|
}
|
|
|
|
|
|
|
|
ref := st.Copy()
|
|
|
|
b.ResetTimer()
|
|
|
|
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
require.NoError(b, ref.AppendCurrentParticipationBits(byte(2)))
|
|
|
|
ref = st.Copy()
|
|
|
|
}
|
|
|
|
}
|