Avoid unnecessary object duplication using passing arguments by reference
Merge pull request #3888 from ktaobo/avoid-copy

Avoid unnecessary object duplication using passing arguments by reference