mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
Looks like (in some very EVM specific tests) we spent a lot of time
resizing memory. If the underlying array is big enough, we can speed it
up a bit by simply slicing the memory.
goos: linux
goarch: amd64
pkg: github.com/ethereum/go-ethereum/core/vm
cpu: Intel(R) Core(TM) Ultra 7 155U
│ /tmp/old.txt │ /tmp/new.txt │
│ sec/op │ sec/op vs base │
Resize-14 6.145n ± 9% 1.854n ± 14% -69.83% (p=0.000 n=10)
│ /tmp/old.txt │ /tmp/new.txt │
│ B/op │ B/op vs base │
Resize-14 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=10)
│ /tmp/old.txt │ /tmp/new.txt │
│ allocs/op │ allocs/op vs base │
Resize-14 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
From the blocktest benchmark:
620ms 10.93s (flat, cum) 9.92% of Total
. . 80:func (m *Memory) Resize(size uint64) {
30ms 60ms 81: if uint64(m.Len()) < size {
590ms 10.87s 82: m.store = append(m.store, make([]byte, size-uint64(m.Len()))...)
. . 83: }
. . 84:}
---------
Co-authored-by: Felix Lange <fjl@twurst.com>
|
||
|---|---|---|
| .. | ||
| program | ||
| runtime | ||
| testdata | ||
| analysis_legacy.go | ||
| analysis_legacy_test.go | ||
| common.go | ||
| contract.go | ||
| contracts.go | ||
| contracts_fuzz_test.go | ||
| contracts_test.go | ||
| doc.go | ||
| eips.go | ||
| errors.go | ||
| evm.go | ||
| gas.go | ||
| gas_table.go | ||
| gas_table_test.go | ||
| instructions.go | ||
| instructions_test.go | ||
| interface.go | ||
| interpreter.go | ||
| interpreter_test.go | ||
| jump_table.go | ||
| jump_table_export.go | ||
| jump_table_test.go | ||
| jumpdests.go | ||
| memory.go | ||
| memory_table.go | ||
| memory_test.go | ||
| opcodes.go | ||
| operations_acl.go | ||
| operations_verkle.go | ||
| stack.go | ||
| stack_table.go | ||