Skip to content

Commit

Permalink
core/vm: allocate stack to 1024
Browse files Browse the repository at this point in the history
Pre allocate the stack to 1024 optimising stack pushing, reducing calls
to runtime.makeslice and runtime.mallocgc
  • Loading branch information
obscuren committed May 25, 2017
1 parent ef25b82 commit 846d091
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/vm/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Stack struct {
}

func newstack() *Stack {
return &Stack{}
return &Stack{data: make([]*big.Int, 0, 1024)}
}

func (st *Stack) Data() []*big.Int {
Expand Down

0 comments on commit 846d091

Please sign in to comment.