Skip to content

Commit

Permalink
For the OpMap VM instruction, since numElements is known just use the…
Browse files Browse the repository at this point in the history
… capacity hint. (#347)
  • Loading branch information
deckarep committed Sep 21, 2021
1 parent de6dc1e commit d9b300c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func (v *VM) run() {
case parser.OpMap:
v.ip += 2
numElements := int(v.curInsts[v.ip]) | int(v.curInsts[v.ip-1])<<8
kv := make(map[string]Object)
kv := make(map[string]Object, numElements)
for i := v.sp - numElements; i < v.sp; i += 2 {
key := v.stack[i]
value := v.stack[i+1]
Expand Down

0 comments on commit d9b300c

Please sign in to comment.