mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
fix: benchmark deserialize without clone and init trie (#12626)
* fix: benchmark deserialize without clone * remove tree initialization --------- Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
af0ee9bd16
commit
7e474b7a30
@ -269,18 +269,20 @@ func prettyPrint(sszPath string, data fssz.Unmarshaler) {
|
||||
func benchmarkHash(sszPath string, sszType string) {
|
||||
switch sszType {
|
||||
case "state_capella":
|
||||
data := ðpb.BeaconStateCapella{}
|
||||
if err := dataFetcher(sszPath, data); err != nil {
|
||||
st := ðpb.BeaconStateCapella{}
|
||||
rawFile, err := os.ReadFile(sszPath) // #nosec G304
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
startDeserialize := time.Now()
|
||||
st, err := state_native.InitializeFromProtoCapella(data)
|
||||
if err != nil {
|
||||
log.Fatal("not a state")
|
||||
if err := st.UnmarshalSSZ(rawFile); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
deserializeDuration := time.Since(startDeserialize)
|
||||
|
||||
start := time.Now()
|
||||
root, err := st.HashTreeRoot(context.Background())
|
||||
root, err := st.HashTreeRoot()
|
||||
if err != nil {
|
||||
log.Fatal("couldn't hash")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user