Profiling in Maya is no worse or better than profiling in most other API environments.
Build yourself boost chrono already and time your work if you have performance concerns (given Maya’s love for ancient compilers that have no C++11 stl).
In this specific case you look like you’re going after what you think would be an optimization on a gut feeling but without having actually profiled, timed or tested the case. It is very likely not going to net you much, if anything, or worse will result in a loss.
Vectors are extremely fast, when presized the difference between one and an array is practically insignificant.
In this case, just because MIntArray offers a C style array return you are assuming that copying the entire content of MIntArray to a C style array and then copying it again into a vector (no move semantics) will be a fast option. It likely won’t be, and it will cost a fair chunk of additional memory as you’d be copying a lot there.
I haven’t profiled MIntArray, but I have used it a fair bit, and I haven’t found it particularly slow, plus it has an [] accessor, so it doesn’t even hamper you syntactically.
Presize your vector and copy directly into it iterating MIntArray fetching through the accessor, and only then, if performance was unsatisfactory, then time it properly, and then try using an intermediate C style array.
I would be surprised though if it turned out to be any faster.
Don’t optimize early on a gut feeling and without having timed unless you have a borderline stellar knowledge of the domain. It’s pointless and hampers learning.