compiler: optimize struct copy a bit
POPITEM is cheaper than PUSH + PICKITEM.
This commit is contained in:
parent
324107b31e
commit
f0fe03117a
1 changed files with 1 additions and 1 deletions
|
@ -852,7 +852,7 @@ func (c *codegen) Visit(node ast.Node) ast.Visitor {
|
|||
// This way even non-pointer struct fields will be copied.
|
||||
emit.Opcodes(c.prog.BinWriter, opcode.NEWARRAY0,
|
||||
opcode.DUP, opcode.ROT, opcode.APPEND,
|
||||
opcode.PUSH0, opcode.PICKITEM)
|
||||
opcode.POPITEM)
|
||||
}
|
||||
}
|
||||
// Do not swap for builtin functions.
|
||||
|
|
Loading…
Reference in a new issue