Skip to content

Commit 5d12fd2

Browse files
committed
save
1 parent 471e1da commit 5d12fd2

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

execution/commitment/commitment_bench_test.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package commitment
1818

1919
import (
20-
"encoding/binary"
2120
"testing"
2221

2322
"github.com/stretchr/testify/require"
@@ -64,60 +63,6 @@ func BenchmarkBranchMerger_Merge(b *testing.B) {
6463
}
6564
}
6665

67-
func BenchmarkBranchData_ReplacePlainKeys(b *testing.B) {
68-
row, bm := generateCellRow(b, 16)
69-
70-
cells, am := unfoldBranchDataFromString(b, "86e586e5082035e72a782b51d9c98548467e3f868294d923cdbbdf4ce326c867bd972c4a2395090109203b51781a76dc87640aea038e3fdd8adca94049aaa436735b162881ec159f6fb408201aa2fa41b5fb019e8abf8fc32800805a2743cfa15373cf64ba16f4f70e683d8e0404a192d9050404f993d9050404e594d90508208642542ff3ce7d63b9703e85eb924ab3071aa39c25b1651c6dda4216387478f10404bd96d905")
71-
for i, c := range cells {
72-
if c == nil {
73-
continue
74-
}
75-
if c.accountAddrLen > 0 {
76-
offt, _ := binary.Uvarint(c.accountAddr[:c.accountAddrLen])
77-
b.Logf("%d apk %x, offt %d\n", i, c.accountAddr[:c.accountAddrLen], offt)
78-
}
79-
if c.storageAddrLen > 0 {
80-
offt, _ := binary.Uvarint(c.storageAddr[:c.storageAddrLen])
81-
b.Logf("%d spk %x offt %d\n", i, c.storageAddr[:c.storageAddrLen], offt)
82-
}
83-
84-
}
85-
_ = cells
86-
_ = am
87-
88-
cg := func(nibble int, skip bool) (*cell, error) {
89-
return row[nibble], nil
90-
}
91-
92-
be := NewBranchEncoder(1024)
93-
enc, _, err := be.EncodeBranch(bm, bm, bm, cg)
94-
require.NoError(b, err)
95-
96-
original := common.Copy(enc)
97-
for b.Loop() {
98-
target := make([]byte, 0, len(enc))
99-
oldKeys := make([][]byte, 0)
100-
replaced, _, err := enc.ReplacePlainKeys(target, func(key []byte, isStorage bool) ([]byte, error) {
101-
oldKeys = append(oldKeys, key)
102-
if isStorage {
103-
return key[:8], nil
104-
}
105-
return key[:4], nil
106-
})
107-
require.NoError(b, err)
108-
require.Lessf(b, len(replaced), len(enc), "replaced expected to be shorter than original enc")
109-
110-
keyI := 0
111-
replacedBack, _, err := replaced.ReplacePlainKeys(nil, func(key []byte, isStorage bool) ([]byte, error) {
112-
require.Equal(b, oldKeys[keyI][:4], key[:4])
113-
defer func() { keyI++ }()
114-
return oldKeys[keyI], nil
115-
})
116-
require.NoError(b, err)
117-
require.EqualValues(b, original, replacedBack)
118-
}
119-
}
120-
12166
// BenchmarkReplacePlainKeys_BufferReuse compares the old pattern (fresh make each call)
12267
// against the new pattern (reused scratch buffer + bytes.Clone), matching what
12368
// replaceShortenedKeysInBranch now does on AggregatorRoTx.

0 commit comments

Comments
 (0)