mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 23:57:23 +00:00
revert add
This commit is contained in:
parent
c31e755c05
commit
da1d57e95d
3 changed files with 6 additions and 36 deletions
|
|
@ -79,20 +79,13 @@ func (m *Memory) Set32(offset uint64, val *uint256.Int) {
|
|||
|
||||
// Resize grows the memory to the requested size.
|
||||
func (m *Memory) Resize(size uint64) {
|
||||
if size <= uint64(len(m.store)) {
|
||||
return
|
||||
if uint64(len(m.store)) < size {
|
||||
if uint64(cap(m.store)) >= size {
|
||||
m.store = m.store[:size]
|
||||
} else {
|
||||
m.store = append(m.store, make([]byte, size-uint64(len(m.store)))...)
|
||||
}
|
||||
}
|
||||
|
||||
if size <= uint64(cap(m.store)) {
|
||||
prevLen := len(m.store)
|
||||
m.store = m.store[:size]
|
||||
clear(m.store[prevLen:])
|
||||
return
|
||||
}
|
||||
|
||||
store := make([]byte, size)
|
||||
copy(store, m.store)
|
||||
m.store = store
|
||||
}
|
||||
|
||||
// GetCopy returns offset + size as a new slice
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/ethereum/go-ethereum/core/vm
|
||||
cpu: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
|
||||
BenchmarkResize-8 876326 89800 ns/op 442142 B/op 1 allocs/op
|
||||
BenchmarkResize-8 signal: interrupt
|
||||
FAIL github.com/ethereum/go-ethereum/core/vm 154.281s
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/ethereum/go-ethereum/core/vm
|
||||
cpu: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
|
||||
BenchmarkResize-8 513681400 4.756 ns/op 5 B/op 0 allocs/op
|
||||
BenchmarkResize-8 747650196 2.313 ns/op 6 B/op 0 allocs/op
|
||||
BenchmarkResize-8 907757728 1.302 ns/op 5 B/op 0 allocs/op
|
||||
BenchmarkResize-8 906696679 1.356 ns/op 5 B/op 0 allocs/op
|
||||
BenchmarkResize-8 832139062 2.823 ns/op 5 B/op 0 allocs/op
|
||||
BenchmarkResize-8 943258486 2.120 ns/op 6 B/op 0 allocs/op
|
||||
BenchmarkResize-8 1000000000 1.619 ns/op 5 B/op 0 allocs/op
|
||||
BenchmarkResize-8 982619973 1.388 ns/op 5 B/op 0 allocs/op
|
||||
BenchmarkResize-8 761129438 1.351 ns/op 6 B/op 0 allocs/op
|
||||
BenchmarkResize-8 943591894 1.643 ns/op 6 B/op 0 allocs/op
|
||||
PASS
|
||||
ok github.com/ethereum/go-ethereum/core/vm 37.469s
|
||||
Loading…
Reference in a new issue