[PyTorch][JIT] Parameter passing & std::map API usage pass on ProfilingRecord::instrumentGraph (#47960)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47960
Audited this code path after seeing it in profiling. Found some issues:
- Multiple lookups in std::map can be avoided by using `std::map::insert`. It's really a find-or-insert, which is what this code wanted anyway.
- Some unnecessary copying of arguments that could be moved from
- We can move from shared_ptrs that are going out of scope anyway
ghstack-source-id: 116914902
Test Plan: Please advise, as I'm new to this code. Does it have test coverage? Is there a way I can easily measure the performance impact of this change?
Reviewed By: Krovatkin
Differential Revision: D24971041
fbshipit-source-id: 881a45f8958854be0e95fba659e0b64bd341501e